Here is the code which I was trying
search(){
this.toDisplay = this.products.filter(function(x){
return this.checkCondition(x.price, condition);
}
}
It is complicated condition like greater than, range, max on the basis of condition number, this function decides condition meet or not and return true or false;
checkCondition(item, condition){
switch(conditoin){
case 1: ... brea;
case 2: ... brea;
case 3: ... brea;
}
return status;
}
Problem is that when i use this.checkCondition inside the filter, always throw checkCondition property of undefined, means this is undefined.
I checked this is always undefined, so how to call a function inside the filter?