Are there any considerations to determine which one is best 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 calling a function immediately after defining it?
javascript function private members
Sheldon ross
source share