You should always pick up localstorage data to do the whole process:
- check item exists
- get item
- on item get
A good practice is to load all localstorage values into global variables as the game starts. To avoid always getting access to the localstorage.
Do not forget to save the new values in storage as well