Hi,

> John, I think there is one difference between both techniques.
>
> While in
>
> new function() {
>
> }
>
> the this keyword points the "anonymous" object itself, in
>
> (function() {
>      ...
> })();
>
> it does not. Right?

The first technique not only creates a new context but also the 'this'-Object. 
try this:

  function test() {
        var a;
        this.a = 42;
        a = 32;
  }

  var b = new test;
  alert(b.a);

This alerts 42. As you see this is another object that the annonymous context. 
The "new function(){...}"-technique has to create one object more than 
the "(function() {...})()"-technique.

Christof

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to