window localstorage setitem code example

Example 1: javascript set localstorage

// SET
localStorage.setItem('myCat', 'Link');

// GET
let aValue = localStorage.getItem('myCat');

Example 2: localstorage set item

localStorage.getItem('data')
localStorage.setItem('token', 'token here');
localStorage.removeItem('token');

Example 3: set localstorage

function set(){
    var sendJson = JSON.stringify(arrayName);
    localStorage.setItem('key',sendJson)
}

Example 4: get localstorage

var pull=JSON.parse(localStorage.getItem('data'))
for(var i=0; i<pull.length; i++){
    new ConstrcterName(pull[i].AnyName, pull[i].AnyName, pull[i].AnyName)
}
for(var o=0; o<arrayName.length; o++){
    ArrayName[o].getRandom();
    ArrayName[o].showRow();