js check if an item is in localstorage keys code example
Example: how to check if local storage variable exists in javascript
if (localStorage.getItem("username") === null) {
//...
}
if (localStorage.getItem("username") === null) {
//...
}