javascript update local storage array

Solutions on MaxInterview for javascript update local storage array by the best coders in the world

showing results for - "javascript update local storage array"
Hanna
17 Nov 2016
1var yesArray = [];
2localStorage.setItem('yesArray', JSON.stringify(yesArray));
3yesArray = JSON.parse(localStorage.getItem('yesArray'));
4yesArray.push('yes');
5localStorage.setItem('yesArray', JSON.stringify(yesArray));
6JSON.parse(localStorage.getItem('yesArray')); // Returns ["yes"]