Answers for "javascript update local storage array"

0

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')); // Returns ["yes"]
Posted by: Guest on September-16-2020

Code answers related to "javascript update local storage array"

Code answers related to "Javascript"

Browse Popular Code Answers by Language