myArray = [{'id':'73','foo':'bar 22'},
{'id':'45','foo':'bar'},
{'id':'46','foo':'area'},
{'id':'47','foo':'line'}]
var allbars = myArray && myArray.filter(function( obj ) {
return obj.foo == "bar";
});
После фильтрации я могу получить
allbars = [{'id':'45','foo':'bar'}]
, но мне нужно, чтобы все клавиши существовали в клавише foo
Expected output is(in the key foo i have bar, bar22 both are expecting in the output but i can able to get only bar)
allbars = [{'id':'45','foo':'bar'}, {'id':'73','foo':'bar 22'}]