Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to read write object to localStorage in js

var testObject = { 'one': 1, 'two': 2, 'three': 3 };

// Put the object into storage
localStorage.setItem('testObject', JSON.stringify(testObject));

// Retrieve the object from storage
var retrievedObject = JSON.parse(localStorage.getItem('testObject'));

console.log('retrievedObject: ', retrievedObject);
Comment

PREVIOUS NEXT
Code Example
Javascript :: jquery copy all options from select to another 
Javascript :: get value of checked radio button jquery 
Javascript :: get filename from url js 
Javascript :: gms2 object method 
Javascript :: change background image through props 
Javascript :: vue watch deep property 
Javascript :: how to check if the user is in a certain guild in discord 
Javascript :: javascript check if var is string 
Javascript :: javascript remove period from end of string 
Javascript :: material ui datepicker remove error 
Javascript :: jsconfig.json vue 
Javascript :: jquery trigger link click 
Javascript :: javascript change all anchors color 
Javascript :: datatable numeric format 
Javascript :: js redirect to url 
Javascript :: redirect link javascript 
Javascript :: disable right click using jquery 
Javascript :: javascript password max length 
Javascript :: Password checking regex 
Javascript :: js get file content from url 
Javascript :: discord js duplicate channel 
Javascript :: document get element by id style 
Javascript :: nodejs readdir 
Javascript :: hide and show in angular 8 
Javascript :: howt to disable a select tag using js 
Javascript :: compress string javascript 
Javascript :: update param in url jquery 
Javascript :: react native run android 
Javascript :: how to count vowels in a string javascript 
Javascript :: js get date from datetime 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =