The only thing you need to understand about LocalStorage contrary to WebStorage is, that data is fetched asynchronously, meaning on one tick you may get or set data, but it will not be immediately available in that tick, like it would with the webstorage.
When getting or setting the data is finished, localstorage will trigger the "on item 'x' get" / "on item 'x' set" etc. events, so you use those events to do the followup actions (like setting the highscore variable to the highscore data from the storage)