setting items to localStorage code example
Example 1: how to get data from localstorage in javascript
var data = JSON.parse(localStorage.getItem("key name"));
Example 2: javascript storage get set item
let target = document.getElementById("target");
let increment = document.getElementById("increment");
let count = localStorage.getItem("counter") || 0;
target.innerHTML = count;
increment.addEventListener("click", () => {
count++;
localStorage.setItem("counter", count);
target.innerHTML = count;
})