La principale différence appelle la fonction d'un « nouveau » et en attribuant la fonction anonyme à une variable
ECMA 262 15.3.2: Lorsque la fonction est appelée dans le cadre d'une nouvelle expression, il est constructeur: initialise l'objet nouvellement créé.
Alors this.foo = new (function() {..})();
crée un nouvel objet et l'affecte à this.foo
et
this.foo = function(){...};
définit une fonction anonyme et l'affecte à this.foo
aussi une autre façon est this.foo = (function() {..})();
(sans la « nouvelle ") appelle la fonction et affecte sa valeur de retour à this.foo
Dans votre cas si vous alertez:
var foo = new (function() {})();
var bar = function() {};
var baz = (function() {return "boo";})(); // without the "new"
alert(foo); // will alert [object Object], the newly created object
alert(bar); // will alert function) {}, the function itself
alert(baz); // will alert "boo", the functions return value
Voir aussi: http://stackoverflow.com/questions/2274695/new-function-with-lower-case-f-in-javascript et http://stackoverflow.com/questions/1895635/javascript -singleton-question – CMS