运算数为数字 typeof(x) = "number"
字符串 typeof(x) = "string"
布尔值 typeof(x) = "boolean"
对象,数组和null typeof(x) = "object"
函数 typeof(x) = "function"
typeof 运算符返回一个用来表示表达式的数据类型的字符串。
可能的字符串有:"number"、"string"、"boolean"、"object"、"function" 和 "undefined"。
如:
alert(typeof (123));//typeof(123)返回"number"
alert(typeof ("123"));//typeof("123")返回"string"
var temp;
alert(temp); //提示undefined
alert(document.abc); //提示undefined
alert(typeof(document.abc)) //提示undefined
相关文章:
-
2021-10-24
-
2022-12-23
-
2022-12-23
-
2021-09-16
-
2021-09-15
-
2021-08-30
-
2022-12-23
-
2022-12-23
猜你喜欢
-
2022-02-16
-
2021-10-06
-
2022-02-12
-
2022-12-23
-
2022-12-23
-
2022-12-23
-
2022-01-26
相关资源
-
下载
2023-01-02
-
下载
2023-01-16
-
下载
2021-06-24
-
下载
2022-12-12