js判断undefined类型

很多时候我们喜欢了if判断
直接

if (reValue== undefined){
alert("undefined");
}

发现是不可以的。
我们需要转换一下才可以

if (typeof(reValue) == "undefined") {
alert("undefined");
}

typeof 返回的是字符串,有六种可能:"number"、"string"、"boolean"、"object"、"function"、"undefined"

原文地址:https://www.cnblogs.com/marker/p/3944354.html