I am currently filtering my JSON, it works fine if I filter it with a hard coded value.
Code Sample:
this.names= this.names.filter(function (name) {
return name.last== 'lastname';
});
It returns the object where the value of the last key is 'lastname'. However, when I use a variable to filter
Code:
this.names= this.names.filter(function (name) {
return name.last== this.selectedLname';
});
It shows cannot read property of 'selectedLname' in console error, but the selectedLname has a value