get item from local storage javascript code example
Example 1: get localstorage
function get(){
var getJson = localStorage.getItem('key')
if(getJson){
arrayName = JSON.parse(getJson)
}
}
Example 2: how to get all items in localstorage
function allStorage() {
var values = [],
keys = Object.keys(localStorage),
i = keys.length;
while ( i-- ) {
values.push( localStorage.getItem(keys[i]) );
}
return values;
}
Example 3: javascript get local storage
var Item = localStorage.getItem('youritem');
Example 4: get localstorage
var pull=JSON.parse(localStorage.getItem('data'))
for(var i=0; i<pull.length; i++){
new arrayName(pull[i].AnyName, pull[i].AnyName, pull[i].AnyName)
Example 5: localstorage.getitem()
localStorage.setItem('myCat', 'Tom');
const cat = localStorage.getItem('myCat');
localStorage.removeItem('myCat');
localStorage.clear();