How to delete certain item from array in localstorage?
问题 I've been working on a tool to help people keep track of their cars in GTA, but I can't figure out how to remove them. I've tried multiple things, but can't get it to work. Here's my codepen https://codepen.io/Tristangre97/pen/dyoyOKw?editors=1010 function deleteItem(index) { var existingEntries = JSON.parse(localStorage.getItem("allCars")); existingEntries.splice(0, index); // delete item at index } 回答1: Splice won't update the local storage, instead, once you have removed the items you need