Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

local storage javascript object

var person = { "name": "billy", "age": 23};

localStorage.setItem('person', JSON.stringify(person)); //stringify object and store
var retrievedPerson = JSON.parse(localStorage.getItem('person')); //retrieve the object
Comment

local storage javascript

function createItem() {
	localStorage.setItem('nameOfItem', 'value'); 
} 
createItem() // Creates a item named 'nameOfItem' and stores a value of 'value'

function getValue() {
	return localStorage.getItem('nameOfItem');  
} // Gets the value of 'nameOfItem' and returns it
console.log(getValue()); //'value';
Comment

local storage javascript

localStorage.setItem('user_name', 'Rohit'); //store a key/value
var retrievedUsername = localStorage.getItem('user_name'); //retrieve the key
Comment

PREVIOUS NEXT
Code Example
Javascript :: convert firestore timnestamp to javascript 
Javascript :: requirenativecomponent rnsscreen was not found in the uimanager 
Javascript :: nombre random js 
Javascript :: convert json to base64 javascript 
Javascript :: convert base64 string to byte array javascript 
Javascript :: js convert double to int 
Javascript :: protractor move mouse and click 
Javascript :: input type number react native 
Javascript :: javascript array to comma separated list 
Javascript :: React CKeditor Upload Adapter 
Javascript :: js get url params 
Javascript :: javascript add string to middle of string 
Javascript :: javascript get all select options 
Javascript :: javascript numero al cuadrado 
Javascript :: javascript date set time 23 59 59 
Javascript :: center horizontally react native 
Javascript :: value from getelementbyid 
Javascript :: react or vue 
Javascript :: js tolocalestring with hours 
Javascript :: js map value in range 
Javascript :: javascript replace element 
Javascript :: get device type using javascript 
Javascript :: javascript print numbers in the given range 
Javascript :: jest check buffer 
Javascript :: datatable after render event 
Javascript :: console regex 
Javascript :: how to get id of parent element in jquery 
Javascript :: javascript read input from terminal 
Javascript :: adonis join condition 
Javascript :: date regex 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =