I have been doing a lot of research on this lately, but have yet to get a really good solid answer. I read somewhere that a new Function() object is created when the JavaScript engine comes across a function statement, which would lead me to believe it could be a child of an object (thus becoming one). So I emailed Douglas Crockford, and his answer was:
Not exactly, because a function statement does not call the compiler.
But it produces a similar result.
Also, to my knowledge, you can't call members on a function constructor unless it has been instantiated as a new object. So this will not work:
function myFunction(){
this.myProperty = "Am I an object!";
}
myFunction.myProperty; // myFunction is not a function
myFunction().myProperty; // myFunction has no properties
However, this will work:
function myFunction(){
this.myProperty = "Am I an object!";
}
var myFunctionVar = new myFunction();
myFunctionVar.myProperty;
Is this just a matter of semantics... in the whole of the programming world, when does an object really become an object, and how does that map to JavaScript?