Relative Content

Tag Archive for javascriptarraysangulartypescript

Shopping cart Issue (incrementing and decrementing product amount)

I’m building a shopping cart and i encountered a problem decrementing products from the array.
this cart takes in a product, if a product already exist, increment its amount.
for decrementing if the item amount is ===1, add to cart.
This is my Add to cart function