I wasn't sure how to ask this, and I apologize if it's been asked already, but I could not find it or an answer.
What is returned when you assign a function to a var.
var obj = function(){
this.name = 'Steve';
}
alert( obj.name === '');//true
obj.name = 'Mike';
alert( obj.name === '');//true
obj.foo = 'fall';
alert( obj.foo );//fall
I know obj is now a function/object and I can call obj(). I also know that the function attached to obj is a constructor for new objects of type obj. If I do
var newObj = new obj();
alert( newObj.name );//Steve
"Steve" is printed. etc. etc.
Why does obj seem to have a property called "name" attached to it? And why when I try to assign a value to that property does it not get assigned?