array, foods = [{ name: 'Apple', color: 'red' }, { name: 'Egg', color: 'white' }];
and here's what I tried,
let foods = [{ name: 'Apple', color: 'red' }, { name: 'Egg', color: 'white' }];
function removeRed(food) {
food.filter(function (x) {
if (x.color !== 'red') {
return true;
} else {
return false;
}
});
return foods;
When I call the function like " removeRed(foods) " the output is giving both of the property-value pairs in my array. I'm a beginner student and this is my first Question here. Hope that someone answers :'D }