how to get array from localstorage in javascript code example
Example 1: javascript store array in localstorage
var colors = ["red","blue","green"];
localStorage.setItem("my_colors", JSON.stringify(colors));
var storedColors = JSON.parse(localStorage.getItem("my_colors"));
Example 2: localstorage save array
var names = [];
names[0] = prompt("New member name?");
localStorage.setItem("names", JSON.stringify(names));
var storedNames = JSON.parse(localStorage.getItem("names"));
Example 3: localstorage javascript array
var array = [1, 2, 3];
localStorage.setItem('myArray', JSON.stringify(array));
var array = localStorage.getItem('myArray');
array = JSON.parse(array);
Example 4: js get array object from local storage
localStorage.setItem("users", JSON.stringify(users));