I have an array that is at the beginning empty, so I have my function that I use to controll element inside array:
saveProducts(product){
 let originalProd = JSON.parse(localStorage.getItem("PRODUCT_ORIGINAL")) // at the beginning is null
  if( originalProd !== null && originalProd.length > 0){
  originalProd.some(element => {
    if ( element.productName !== product.name){
       this.originalProductToSave.push({ productName: product.name, productQuantity: product.quantity, productPrice: product.price })
    else if(element.productName === product.name && element.productQuantity !== product.quantity){ element.productQuantity = product.quantity}
     }
   }
 }
else{
  this.originalProductToSave.push({ productName: product.name, productQuantity: product.quantity, productPrice: product.price })
   }
}
Now this originalProductToSave is saved on localStorage in this way originalProd has the same values. My problem is about how to save elements inside array because I don't want duplicate, and using some I have duplicated inside, for example
originalProd=[{productName: "001",....}, {productName: "002",.....}]
So If I try for example to add another time product with name 002 it checks between 001 != 002 and it adds another time 002
 
    