how to store data of local storage in array 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: javascript update local storage array
var yesArray = [];
localStorage.setItem('yesArray', JSON.stringify(yesArray));
yesArray = JSON.parse(localStorage.getItem('yesArray'));
yesArray.push('yes');
localStorage.setItem('yesArray', JSON.stringify(yesArray));
JSON.parse(localStorage.getItem('yesArray'));