Answers for "how to tell if something is an element in localstorage"

0

check if there is data in localstorage

if (localStorage.getItem('ID') !== null) {
    console.log(` exists`);
} else {
    console.log(`not found`);
}
Posted by: Guest on September-08-2021
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 tell if something is an element in localstorage"

Code answers related to "Javascript"

Browse Popular Code Answers by Language