Answers for "how to check if an element exists or not in local storage javascript"

5

how to check if local storage variable exists in javascript

if (localStorage.getItem("username") === null) {
  //...
}
Posted by: Guest on February-28-2020
1

check if item exists in localstorage javascript

//If the given key does not exist in the list associated with the object then this method must return null.

if (localStorage.getItem("infiniteScrollEnabled") === null) {
  //...
}
Posted by: Guest on June-03-2021

Code answers related to "how to check if an element exists or not in local storage javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language