+ 2

Why localStorage doesn't work?

Why localStorage.setItem() doesn't work?

2nd Mar 2019, 6:41 PM
Erik Moučka
Erik Moučka - avatar
4 ответов
+ 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')
2nd Mar 2019, 7:20 PM
Erik Moučka
Erik Moučka - avatar
+ 2
//It works on browser, maybe your source code contains errors
2nd Mar 2019, 6:55 PM
Sudarshan Rai
Sudarshan Rai - avatar
+ 1
//LocalStorage is not supported here on sololearn https://www.sololearn.com/discuss/1199130/?ref=app
2nd Mar 2019, 6:49 PM
Sudarshan Rai
Sudarshan Rai - avatar
+ 1
But I tried to create a html file and opened it in the browser and it does not work either.
2nd Mar 2019, 6:53 PM
Erik Moučka
Erik Moučka - avatar