“JavaScript Store di LocalStorage” Kode Jawaban

JavaScript Store di 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

LocalStorage 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

Jawaban yang mirip dengan “JavaScript Store di LocalStorage”

Pertanyaan yang mirip dengan “JavaScript Store di LocalStorage”

Lebih banyak jawaban terkait untuk “JavaScript Store di LocalStorage” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya