Various options:
1) The function is not named, so you will not get the name of the function in MyObject.toString()
var MyObject = function(){};
2) The function is named, so you get the function name in MyObject.toString() , but this is still not recommended.
var MyObject = function MyObject (){};
Effectively, there is no practical difference between (1) and (2)
3) Function declaration instead of function expression ( See related discussion )
function MyObject() {}
This differs from the previous parameters in that it is in the area before the actual declaration, so the following code works fine:
MyObject(); function MyObject() {}
But if you try this:
MyObject(); var MyObject = function(){};
You will receive an error message.
I usually just stick to option 1, as it seems the most logical
neelsg
source share