Ask your JavaScript questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

How to get 'quantity' of === 'apples' JavaScript


How to get 'quantity' of === 'apples' Note that the program stops if the target record doesn't exist. I need to fix that, too. Check for name == 'apples' somehow.

search term = "apples";

const fruits = [
{name: 'apples', quantity: 2},
{name: 'bananas', quantity: 0},
{name: 'cherries', quantity: 5}

const getFruit = fruits.find(fruit => === searchterm);


Answers (0)

No answers yet.