I am using this code to check undefined variable but it\'s not working.
Use 'this' keyword to access variable. This worked for me
var uemail = localStorage.getItem("useremail"); if (typeof this.uemail === "undefined") { alert('undefined'); } else { alert('defined'); }