I want to use an array method with arrow function. For an example:
const inventory = [
{name: 'apples', quantity: 2, type: 'a'},
{name: 'bananas', quantity: 0, type: 'a'},
{name: 'cherries', quantity: 5, type: 'a'}
{name: 'mangos', quantity: 5, type: 'a'}
];
const result = inventory.filter( fruit => fruit.quantity === 5 );
What if i want to return just the object with the name and type properties? Like this:
console.log(result) //[{name: 'mangos', type: 'a'}, {name: 'cherries', type: 'a'}]