Please don’t cross-post. You already asked this in a different forum, and I think the answer I gave you there will provide everything you’re looking for.
So it’s a challenging task you’re setting for yourself. First thing I might suggest, move your localStorage access into their own functions. It will provide you with an easier interface, and will also allow you to later (if you feel daring) use the same code in a whole new way.
For example, with the code the way you have it now, if you decide to create a back-end of some sort (firebase, or node, or whatever), you will have to ‘touch’ the entire codebase to make those changes work.
If, instead,…