未定義の変数をチェックするためにこのコードを使っているのですが、うまくいきません。
var uemail = localStorage.getItem("useremail");
if (typeof uemail === "undefined")
{
alert('undefined');
}
else
{
alert('defined');
}
これについては、トゥルースを確認すればよい。
if(uemail) {
console.log("I have something");
} else {
console.log("Nothing here...");
}
ここから答えを確認してください: https://stackoverflow.com/questions/5515310/is-there-a-standard-function-to-check-for-null-undefined-or-blank-variables-in
ご参考になれば幸いです。