“JavaScript Store in LocalStorage” Code-Antworten

JavaScript Store in LocalStorage

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
Grepper

LOCALSTORAGE JavaScript

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

Lokalstorage JS

// Set
localStorage.setItem('monChat', 'Tom');

// Get
localStorage.getItem('myCat');

// Remove
localStorage.removeItem('myCat');
Lively Leopard

LOCALSTORAGE JavaScript

localStorage.setItem(key, val);
var val = localStorage.getItem(key);
localStorage.removeItem(key);
localStorage.clear();
Successful Sandpiper

Ähnliche Antworten wie “JavaScript Store in LocalStorage”

Fragen ähnlich wie “JavaScript Store in LocalStorage”

Weitere verwandte Antworten zu “JavaScript Store in LocalStorage” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen