On 6 December 2010 16:14, Casey Goodhew <[email protected]> wrote: > Out of curiosity Marko, why would you avoid the "new"? I'm not against it, > just looking for the reasoning (we use this pattern in our code quite a > bit).
There's nothing wrong with new. Douglas Crockford has been stung by it once and reacted by recommending against its use, advice which has been lapped up demurely by large sections of the JavaScript community. The argument is that if you call a constructor function and forget the new, the function will likely still work without error and lead to hard-to-detect bugs. However, I've never in 12 years of JavaScript development using new had such a bug, possibly because of the simple expedient of starting constructor function names with a capital letter and all other functions with a lower case letter. Tim _______________________________________________ JSMentors mailing list [email protected] http://jsmentors.com/mailman/listinfo/jsmentors_jsmentors.com
