Devuelve el primer objeto coincidente de una matriz
function priceLookup(items, name) {
for (let i = 0; i < items.length; i++) {
if (name === items[i].itemName) {
// the return will break the loop and exit the function
return items[i].price;
}
}
// if loop completes no matches were found
return "No item found with that name"
}
Energetic Echidna