![]() ![]() ![]() Which means that we now have a new property in Function object with name "name", and its a function 'func'. This refers to Function object when the 'method' is invoked from Function objects like Number, String, etc. This also means that if method property is added to Function.prototype object, it would be available to all the possible Function objects in javascript. This means every Function object has access to properties of Function.prototype, since every Function object inherits Function.prototype object. It is the object whom _ proto _ of every function object refers. It means any inheriting object can use any property of inherited object. So if objA has _ proto _ equal to objB, and objB has _ proto _ equal to objC, then objA inherits objB and objC, while objB inherits objC. Some good resource on this could be found atĪn object objA inherits another object objC if objA and objC are connected through any number of _ proto _. ![]() The _ proto _ is what defines the inheritance. Moreover, any Function instance object (created using new constructor) has a property _ proto _. To avoid confusion, I would refer such objects as Function object, and for object created using new () construct of a function as Function instance object.Īny function object in javascript has two properties: _ proto _ and prototype. From this, I mean not the object created by new () construct, but the function itself. ![]() Function object vs Function instance objectįirst of all, in javascript, a function is also an object. ![]()
0 Comments
Leave a Reply. |