Skip to content

Instantly share code, notes, and snippets.

for (var key in object) {
// obj is the value assigned to the key in the object
var obj = object[key];
console.log(obj);
}
@nrojas13
nrojas13 / arrayLocalStorage.js
Created November 3, 2016 23:39
Cómo guardar un array en localStorage
// Guardar el array en el localStorage
// El arreglo:
var array = [1, 2, 3];
// Se guarda en localStorage despues de JSON stringificarlo
localStorage.setItem('myArray', JSON.stringify(array));
// Obtener el arreglo de localStorage
var array = localStorage.getItem('myArray');
@nrojas13
nrojas13 / localStorageArrays.js
Created November 3, 2016 23:32
How to store an array in localstorage js
// Store an array in local storage
// The array to store
var array = [1, 2, 3];
// Store after JSON stringifying (is this a verb?) it
localStorage.setItem('myArray', JSON.stringify(array));
// Get an array from local storage
// Retrieve the array from local storage