Answers for "check if item is in local storage and do something"

5

how to check if local storage variable exists in javascript

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

how to check if local storage is available

if (typeof(Storage) !== "undefined") 
{ 
	console.log("localStorage is available."); 
} 
else 
{ 
	console.log("localStorage is not supported by current browser."); 
}
Posted by: Guest on April-23-2021

Code answers related to "check if item is in local storage and do something"

Code answers related to "Javascript"

Browse Popular Code Answers by Language