typeof (Array, null) 返回对象,typeof(null, Array) 返回函数
typeof (Array, null) returns object and typeof(null, Array) returns function
正如标题所说明的那样,typeof (Array, null)
返回object
,typeof(null, Array)
返回function
。
它返回第二个参数的类型。
为什么?
因为
-
typeof
是一个运算符,而不是一个函数,所以typeof(expr)
是typeof expr
的,首先计算expr
-
a,b
返回b
所以
typeof (a, b)
返回typeof b
在您的情况下
-
typeof (Array, null)
typeof null
这是"object"
-
typeof(null, Array)
是typeof Array
,Array
是一个函数。
相关文章:
- 节点导出返回一个空对象
- 为什么typeof的数组的数组的未定义值返回为“0”;未定义的“;我的条件不认为是真的
- 为什么typeof(null)返回“;对象”;,但是你可以't为其分配属性
- 为什么要使用与 typeof 的返回值进行严格比较
- angularjs:不能显示 JS 'typeof' 的返回值
- 为什么 typeof 3>2 在 JavaScript 控制台中返回 false
- 字符串值函数上的 Javascript typeof 运算符返回“函数”而不是“字符串”
- 在 JavaScript 中,如果数组,函数是对象原型,那么为什么 TypeOf 返回
- typeof (Array, null) 返回对象,typeof(null, Array) 返回函数
- 为什么console.log()显示一个数组,而typeof返回'对象'
- typeof(“2px”-1)返回数字;2px〃-1返回NaN.为什么?
- JavaScript typeof运算符是否返回过大写字符串
- 与typeof运算符一起使用时,javascript null返回对象
- Typeof操作符返回一个非空的字符串
- Instanceof与typeof方法返回的对象类型相矛盾
- 为什么是文档.除typeof文档外所有已定义.所有返回“未定义”
- 为什么“typeof false || undefined”返回"布尔值”;
- Javascript typeof item === "undefined"永远不会返回true
- 编辑:为什么typeof(0)返回布尔值而不是数字?
- 为什么"typeof+''"返回'数字'