how to see if a key exist in local storage js code example Example: local storage check if key exists if (localStorage.getItem("username") === null) { //... }