为什么typeof Object,String,Number ... -a函数在Javascript中

car*_*sel 3 javascript typeof

以下摘自Google Developer Console

typeof Object  // type of Object is function (most confusing part).
"function"      //Same fot all build-in types

Object.constructor 
function Function(){[native code]}// Why not function Object()?

Object.hasOwnProperty("create")  // Here, it is Object since it has property,not typeof      
"true"                              function


dir(Object) // Again, Object is object,it has property (method)
function Object() { [native code] }
Run Code Online (Sandbox Code Playgroud)

为什么typeof Object不是Object?为什么Object.constructor不是函数Object()?

谢谢MIro

Aln*_*tak 7

标识符Object,String等等都不是"类名",你可能会在其他语言中都看到了.它们也不是特定类型的实例.

Object它本身就是"对象" 的构造函数,即对函数的引用.

更复杂的是,Javascript函数也是对象,它们可能具有属性.这些属性通常用于向对象添加方法.