Promise() vs. new Promise()

Claude Pache claude.pache at
Wed Aug 20 08:18:49 PDT 2014

Le 20 août 2014 à 16:56, Alex Kocharin <alex at> a écrit :

> But... why?
> I mean, every constructor can determine if it is called without `new` (that "this instanceof" check on top of every other constructor). So `new` keyword can really be removed from everywhere except in constructors themselves.
> Using `new` does create issues. For example, you can't write "new require('something').Constructor(blah)", and I don't even remember how to put brackets right.
> Why make people use it?

According to (search for "anti-pattern"), allowing constructors without `new` would break subclassing.


More information about the es-discuss mailing list