Answers for "check if localstorage value exists"

5

check if localstorage key exists

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
0

check if localstorage key exists js

if("user" in localStorage){
   alert('yes');
} else {
   alert('no');
}
Posted by: Guest on July-04-2020

Code answers related to "check if localstorage value exists"

Code answers related to "Javascript"

Browse Popular Code Answers by Language