永发信息网

javascript的typeof 返回哪些数据类型

答案:3  悬赏:0  手机版
解决时间 2021-01-29 12:39
  • 提问者网友:佞臣
  • 2021-01-28 23:20
javascript的typeof 返回哪些数据类型
最佳答案
  • 五星知识达人网友:轮獄道
  • 2021-01-29 00:07
Undefined "undefined"

Null "object" (see below)
Boolean "boolean"
Number "number"
String "string"
Symbol (new in ECMAScript 2015) "symbol"
Host object (provided by the JS environment) Implementation-dependent
Function object (implements [[Call]] in ECMA-262 terms) "function"
Any other object "object"
参照 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof
全部回答
  • 1楼网友:走死在岁月里
  • 2021-01-29 01:47
typeof的运算数未定义,返回的就是 "undefined". 运算数为数字 typeof(x) = "number" 字符串 typeof(x) = "string" 布尔值 typeof(x) = "boolean" 对象,数组和null typeof(x) = "object" 函数 typeof(x) = "function"
  • 2楼网友:十鸦
  • 2021-01-29 00:33
1-----undefined string boolean number object -------对象或者null返回的是object function 这些是typeof返回的类型字符串 2------var box; alert(box); 没有初始化的变量就是undefined 3-----alert(typeof box); 4-----var box={}; alert(typeof box); 就是object 5-----var box={}; alert(box); 就是[object object] 6----null派生自object 7---var box =new object(); alert(box); 8----function king(){} alert(king); 9-----var box="wjje"; alert(typeof "wjje"); alert(typeof box); 10-----typeof 是内置的操作符而非函数 11-----不赋值的时候就是undefined
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯