Local storage only handles Strings. Use JSON.stringify(library_science1)
before you store, and JSON.parse(localStorage.library_science1)
when you read from localStorage.
Saving a particular Objects property in localstorage
-
13-10-2022 - |
Pergunta
The standard
localStorage.var = var;
Isn't working for me, for example:
localStorage.library_science1.owned = library_science1.owned;
Where library_science1 is a previously created Object with the 'owned' property. Can anyone please help?
Nenhuma solução correta
Outras dicas
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow