方法:
if (typeof(reValue) == "undefined") {
alert("undefined");
}
[b]PS: typeof 返回的是字符串,有六种可能:"number"、"string"、"boolean"、"object"、"function"、"undefined"[/b]
if (typeof(reValue) == "undefined") {
alert("undefined");
}
[b]PS: typeof 返回的是字符串,有六种可能:"number"、"string"、"boolean"、"object"、"function"、"undefined"[/b]
JS类型检查示例
本文介绍了一段JavaScript代码,该代码演示了如何使用typeof操作符来检查变量的数据类型。typeof操作符可以返回表示变量类型的字符串,例如'number'、'string'、'boolean'等。当变量未定义时,它会返回'undefined'。
310

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



