Answers for "How to replace a value in localstorage using javascript"

0

How to replace a value in localstorage using javascript

let productCost = +document.getElementById('projectcost').value;
let productQty = +document.getElementById('productQty'+id).value;
let product_list = JSON.parse(localStorage.getItem('myItems') ?? "[]");
                       .filter(({productId}) => productId != id)
                       .concat({productId: id, productCost, productQty});
localStorage.setItem('myItems', JSON.stringify(product_list));
Posted by: Guest on May-09-2022

Code answers related to "How to replace a value in localstorage using javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language