Javascript new object (function ) vs inline invocation
- by Sheldon Ross
Is there any considerations to determine which is better practice for creating an object with private members?
var object = new function () { 
   var private = "private variable";
   return {
       method : function () { 
           ..dosomething with private;
       }
   }
}
VS
var object = function () {
 ...
}();
Basically what is the difference between using NEW here, and just invoking the function immediately after we define it?