Answers for "check if local storage is set js"

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 local storage is set js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language