get item from 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'); //store a key/value
var retrievedUsername = localStorage.getItem('user_name'); //retrieve the key
Example 3: getitem localstorage
// localStorage--> userName: 'jon'
var userName = localStorage.getItem('userName');
// userName --> jon
Example 4: javascript get local storage
var Item = localStorage.getItem('youritem');