If I understand correctly you are comparing a password entered by the player (or hopefully loaded from storage) against a known value to determine if a cheat system should be enabled.
The problem with that technique is that the known value is contained within the source code of the story HTML file, and that source code is fairly easier to read for anyone with a little HTML knowledge (or the ability to google it) which means that the known value is is fairly easy to find. So anyone who can find it can by-pass that security system.
You could try changing the above technique to use some formula to determine if the entered (stored) password is correct, but again the source code applying that formula is accessible to the player so they are again able to by-pass it.
Anyway to answer your question about how to persist a value between play-throughs.
You could use the same Javascript localStorage.getItem() and localStorage.setItem() functions used within the Javascript example of this answer to the Global Stats - How do you... question to load & save the password within the player's web-browser's Local Storage.
or as as suggested by @idling, the <<remember>> macro that I forgot SugarCube has.