“LocalStorage em JS” Respostas de código

Javascript Definir valor de armazenamento local

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

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

JavaScript Get Storage Local

  var Item = localStorage.getItem('youritem');
Xenophobic Xenomorph

JavaScript de armazenamento local

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';
DCmax1k

JavaScript de armazenamento local

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

LocalStorage em JS

// Check browser support
if (typeof(Storage) !== "undefined") {
  // Store
  localStorage.setItem("lastname", "Smith");
  // Retrieve
  document.getElementById("result").innerHTML = localStorage.getItem("lastname");
} else {
  document.getElementById("result").innerHTML = "Sorry, your browser does not support Web Storage...";
}
Outrageous Osprey

Respostas semelhantes a “LocalStorage em JS”

Perguntas semelhantes a “LocalStorage em JS”

Mais respostas relacionadas para “LocalStorage em JS” em JavaScript

Procure respostas de código populares por idioma

Procurar outros idiomas de código