getitem localstorage javascript code example
Example 1: get localstorage
function get(){
var getJson = localStorage.getItem('key')
if(getJson){
arrayName = JSON.parse(getJson)
}
}
Example 2: local storage javascript
localStorage.setItem('user_name', 'Rohit');
var retrievedUsername = localStorage.getItem('user_name');
Example 3: getitem localstorage
var userName = localStorage.getItem('userName');
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();
Example 5: localstorage.getitem()
localStorage.setItem('myCat', 'Tom');
const cat = localStorage.getItem('myCat');
localStorage.removeItem('myCat');
localStorage.clear();
Example 6: javascript localstorage
var KeyName = window.localStorage.key(index);