locoalstorage.getItem or save my array | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

locoalstorage.getItem or save my array

Why is locoalstorage.getItem in savedPokemon function not saving my capturedPokemon array when I refresh? Any tips? Here is my code: https://code.sololearn.com/Wa1484a5A10a

5th Apr 2021, 2:01 AM
David Paredes
David Paredes - avatar
3 Answers
+ 1
Well, atleast in sololearn you can't acess local storage.
5th Apr 2021, 2:38 AM
ACADEMIC
ACADEMIC - avatar
5th Apr 2021, 3:22 AM
SAN
SAN - avatar
0
To be clear, localStorage can't be access via Sololearn android app, but localStorage can access when using Sololearn website and Sololearn iOS app. To get the result you want you need to add some extra logic to the savedPokemon function and you should save the array capturedPokemon to localStorage right after every push to capturedPokemon. https://code.sololearn.com/Wa14a253A20a/#
5th Apr 2021, 11:24 PM
ODLNT
ODLNT - avatar