http://jsbin.com/ufihev/3/edit
Pretty simple code :
var t = new function () //line 1
{
this.a1 = function () {
return function () {
alert("1");
};
}();
this.a2 = function () {
alert("a2");
};
}; //line 16
t.a1();
But jsBin red line bellow tells me :
Line 1: var t = new function () --- Weird construction. Delete 'new'.
Line 16: }; --- Missing '()' invoking a constructor.
the code is working fine.
What am I doing wrong ?