javascript - Adding a new element or updating an existing element in an array -
I have a bill array that includes items that the user chooses to take in it
example , Item: 'milk', cost: 1.99, quantity: 1}
What do I want to do, update quantity 2 if second milk is added to the basket and do not add another milk item. This time code Is: i
break set a flag out of the loop If found:
var found = false; (I.e.. } If (! Found) {Bill Push ({items: new entom, cost: cost, quantity: 1});}
Comments
Post a Comment