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 i . Quality ++; } // If this new item bill can not be added, animal ({items: new entom, cost: cost, quantity: 1}); }

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

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -