filter method in javascript
Anonymous
let observers1 =[1,2,3,5];
let a1=9;
let a2=9;
var c =[];
let observers = observers1.filter(function(item){
if(a1 === a2) {
c.push(item);
return "hello";
}
});
In the above code snippets, I am trying to return 'hello' ,for every iteration but I am getting observers1 array element values