Password Saver help HTML + local.Storage

I Have a password saver in html, but i just want it to save. this does it, but then how do i view those passwords?

https://replit.com/@AntoniDruzynski/PSWRD-Extension?v=1#index.html

the code is in the link above, and there is a script.js too.

To save a string to local storage, you can use:

window.localStorage.setItem("name", "value");

To get that string again, you can use:

window.localStorage.getItem("name");
3 Likes

Why are you prepending window.? I thought it wasn’t necessary.

It isn’t really, it’s a personal preference, but localStorage does belong to the window object. In the browser, global variables technically belong to the window object:

var test = 123; // note let and const are local variables (and you shouldn't ever be using var)
console.log(window.test);
2 Likes