Answers for "how to read write array to localstorage in js"

10

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

Code answers related to "how to read write array to localstorage in js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language