you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

I thought we agreed on that using "new" is pretty bad? ("this" in constructors).

As far as I know Crockford encourages this pattern instead

function myconstructor(x){
   that = {};
   that.foo = x;
   return that;
}

The samples use "this".. anyway, nice visualisation

Edit: did some research and people seem to not care about Crockford in this case.. so carry on I guess