Function
and Object
are special types of a function, since having a capital letter starting, they are constructor-functions, right?
Functions as 1st class citizens in JavaScript can have methods (functions that are stored as properties in an object), as well.
So functions are objects, right? The constructor-function Function
's property prototype
has typeof "function" whereas the constructor-function Object
's property prototype
has typeof "object".
Why isn't it "object" both times?
typeof Function.prototype
>"function"
typeof Object.prototype
>"object"
Function.prototype
> ƒ () { [native code] }
Object.prototype
> {…}