Answers for "local storage get item array"

10

local storage javascript array

//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
Posted by: Guest on July-31-2019
5

localstorage save array

var names = [];
names[0] = prompt("New member name?");
localStorage.setItem("names", JSON.stringify(names));

//...
var storedNames = JSON.parse(localStorage.getItem("names"));
Posted by: Guest on September-01-2020
0

js get array object from local storage

users = JSON.parse(localStorage.getItem("users") || "[]");
Posted by: Guest on January-30-2021
-1

js get array object from local storage

localStorage.setItem("users", JSON.stringify(users));
Posted by: Guest on January-30-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language