Answer the question
In order to leave comments, you need to log in
How to solve problems (local storage)?
There is such a code, it's not a basket, it's simpler and easier to explain.
Here is a link to the code .
How can I make sure that the key is not repeated? It can be seen that the information but the key is the same and it turns out that the values are simply replaced. I did not find an answer on the Internet, the key should be generated by itself.
Answer the question
In order to leave comments, you need to log in
MDN says https://developer.mozilla.org/en-US/docs/Web/API/S...
storage.setItem(keyName, keyValue);
those. your key is the string 'id'
here is the code jsfiddle.net/cfk0uLwp
here the key is the id value
if you need to count the quantity, here is the answer to stackoverflow
stackoverflow.com/questions/2010892/storing-object...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question