I am trying to filter an array with all the possible matches. How can i implement please guide me.
arr = [{test: 100}, {test: 100A}, {test: 100B}, {test: 100C}, {test: 101}, {test: 101}]
// i want to filter the above array which matches 100.
I have tried.
var arr1 = arr.filter(x => x.test === 100);
console.log(arr1);
it returns only {test: 100} instead i want {test: 100}, {test: 100A}, {test: 100B}, {test: 100C}
{test: 100A}is not valid javascript syntax, are you sure this is the array?SyntaxErrorwith your currentarr.