if (reValue== undefined){
alert("undefined");
}
发现判断不出来,最后查了下资料要用typeof
方法:
if (typeof(reValue) == "undefined") {
alert("undefined");
}
typeof 返回的是字符串,有六种可能:"number"、"string"、"boolean"、"object"、"function"、"undefined"
本文探讨了在JavaScript中如何正确地检测一个变量是否为undefined。通过对比不同方法,指出了使用typeof操作符进行检查的有效性和重要性,并解释了其返回的六种类型。
384

被折叠的 条评论
为什么被折叠?



