generate functionThu, 08 Dec 2022

const products = [{name :"a", quantity:5}, {name :"c", quantity:3} ] make a function to find by name and increment the quantity. Must be imutable. Must return the updated products array.

function findAndUpdate(products, name){ return{ if ( === name){ product.quantity += 1; } return product; }); }

Generate More

Questions about programming?Chat with your personal AI assistant