JSON:
"offers":[
{
"loanType":"432321CMP"
},
{
"loanType":"788407CMP"
},
{
"loanType":"97934OOW"
},
{
"loanType":"8293EWC-AS"
},
{
"loanType":"6653EWC-AS"
}
]
I want to filter data basis the substring in the end ["EWC-AS", "CMP"]
myArrayFiltered = offers.filter(function(v) {
return (["EWC-AS"].indexOf(v.loanType)) > -1;
});
If I pass on the exact value to match it works, but for substring it does not.