“Simpan objek di LocalStorage JS” Kode Jawaban

Menyimpan objek di HTML5 LocalStorage

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 = localStorage.getItem('testObject');

console.log('retrievedObject: ', JSON.parse(retrievedObject));
Mobile Star

HTML5 Store Object di LocalStorage

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 = localStorage.getItem('testObject');

console.log('retrievedObject: ', JSON.parse(retrievedObject));
Mobile Star

objek toko javascript di penyimpanan lokal

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

Simpan objek di LocalStorage JS

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

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

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

console.log('retrievedObject: ', JSON.parse(retrievedObject));
Wissam

Jawaban yang mirip dengan “Simpan objek di LocalStorage JS”

Pertanyaan yang mirip dengan “Simpan objek di LocalStorage JS”

Lebih banyak jawaban terkait untuk “Simpan objek di LocalStorage JS” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya