+ 2
Why localStorage doesn't work?
Why localStorage.setItem() doesn't work?
4 Answers
+ 2
It works now. I wrote localStorage.setItem('2','4')
The first parameter can not be a text string. I've removed quotes and it's working:
localStorage.setItem(2,'4')
+ 2
//It works on browser, maybe your source code contains errors
+ 1
//LocalStorage is not supported here on sololearn
https://www.sololearn.com/discuss/1199130/?ref=app
+ 1
But I tried to create a html file and opened it in the browser and it does not work either.