Function and Object Javascript

‘Function’ function is an Object, then ‘Function’ object needs another constructor function to build it

No. Function is a native, builtin object whose properties and behavior are defined in section 15.3 of the EcmaScript specification. It was not built by an js function.

Think of it like that: There is a function somewhere in the code of your EcmaScript environment that builds function objects – it is called whenever your script encounters a function expression or declaration. The global Function function is a wrapper for that function to make it accessible for scripts. All function objects which that function returns inherit from the Function.prototype object – it looks like they were constructed by Function. Also the Function.prototype.constructor property that all functions inherit is defined to point to Function.

Leave a Comment