how to store array in localstorage code example
Example 1: javascript store array in localstorage
//storing array in localStorage
var colors = ["red","blue","green"];
localStorage.setItem("my_colors", JSON.stringify(colors)); //store colors
var storedColors = JSON.parse(localStorage.getItem("my_colors")); //get them back
Example 2: localstorage javascript array
// 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');
// Se parsea para poder ser usado en js con JSON.parse :)
array = JSON.parse(array);