Save load array

Hello, i am working on load/save game, since i can’t save an array on a single value i can do it easy with a for loop cycle, the problem is to recover that since the length can change how can i check how many inventory[i] items where saved in localStorage?

I would store it as a JSON string which is pretty easy to serialise/read.

Thanks @yaustar that works fine :wink:

Just a question…when i save a numerical value and load it again is converted into a string?
EDIT: already solved thanks