为什么对象、字符串、数字的类型-Javascript中的函数
下面是谷歌开发者控制台的摘录为什么对象、字符串、数字的类型-Javascript中的函数,javascript,typeof,Javascript,Typeof,下面是谷歌开发者控制台的摘录 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") //
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] }
为什么对象的类型不是对象?为什么Object.constructor不是函数Object()
多谢各位
MIro标识符
对象
,字符串
等不是您在其他语言中可能看到的“类名”。它们也不是特定类型的实例
Object
本身就是“Object”的构造函数,即对函数的引用
更复杂的是,Javascript函数也是对象,可能有属性。这些属性通常用于向对象添加方法