var F functionfunctionfunction() {};
F can access both A and (object and function also, but all instances can only access a); F is an instance of object and function two, so what is the relationship between object and function?
The following is an understanding of object and Function
FinstanceofObjecttrueFinstanceofFunctiontrueObjectinstanceofFunctiontrueFunctioninstanceofObjecttrueObject:functionObject () {[native code]};object.construtorfunctionFunction () {[native code]}; Function:functionFunction () {[native code]}; Function.constructor= = Function;//trueObject= = Function; //false
Can know
1.Object and function have the same constructor functions function function () {[native code]}
2.Object and Function are not equal
instanceof Number falseinstanceof Function trueinstanceof Object Truefunctioninstanceof object True instanceof Function true
3. Other basic types or non-basic types are also instances of the object as well as instances of the function.
If so:
var foo = {}; function = "Value.a"= "value.b"; Console.log (FOO.A); // value.aConsole.log (FOO.B); // undefinedconsole.log (F.A); // value.aConsole.log (f.b); // value.b
So:
FOO.A search Path: Foo itself: no--->foo.__proto__ (object.prototype): Value.a found
FOO.B search Path: Foo itself: no--->foo.__proto__ (object.prototype): No--->foo.__proto__.__proto__ (object.prototype.__ PROTO__): No
F.A Find path: F self: no--->f.__proto__ (function.prototype): No--->f.__proto__.__proto__ (object.prototype): Find Value.a
f.b Find path: F self: no--->f.__proto__ (function.prototype): Value.b found
4. The constructor property of the instance object points to its constructor. So object.contructor = = = function, Function.contructor = = function
JS prototype question What is the relationship between object and function?