localstorage not being set code example Example: how to check localstorage not set if (localStorage.getItem("someName") === null) { // your code }