@KorMar 08.2011 — #It is a constructor. It can create an object and give it pairs property:value <i> </i><script type="text/javascript"> var Employee= new function(){ this.firstname='Bob'; this.name='Dole'; } alert(Employee.firstname); alert(Employee.name); </script>
Usually the constructor is written otherwise: <i> </i><script type="text/javascript"> function Constructor(firstname,name){ this.firstname=firstname; this.name=name; } var Employee=new Constructor('Bob','Dole'); alert(Employee.firstname); alert(Employee.name); </script>
@KorMar 08.2011 — #In that case, new function() creates an anonymous object (anonymous singleton). I guess it is useful in the debugging process. And keeps the inner codes in private scope. <i> </i><script type="text/javascript"> new function(){ this.property='somevalue' this.method=function(){alert(this.property)} this.method() } </script>