网络编程
位置:首页>> 网络编程>> JavaScript>> js用typeof方法判断undefined类型

js用typeof方法判断undefined类型

作者:whsnow  发布时间:2024-04-19 09:53:43 

标签:typeof,undefined

js判断undefined类型


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

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


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

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

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com