A5下载文章资讯

分类分类

JavaScript判断undefined类型的正确方法

2015-06-30 14:19作者:zhao

if (reValue== undefined){

alert("undefined");

}

发现判断不出来,最后查了下资料要用typeof

方法:

if (typeof(reValue) == "undefined") {

alert("undefined");

}

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

展开全部

相关

说两句网友评论
    我要跟贴
    取消