Cant you just "return this;" to avoid using "new"?
THIS will be the global scope if a function meant to be a constructor is called without new.
Try that in your console
function Foo(){this.foo = "bar";return this}
then do : Foo() ;
it will return window;so the answer is no.
Foo.call({}); Foo.call(Object.create(Foo.prototype))I wonder if any linters out there warn when they see something like:
something = SomeCapitalizedFunction()
Because forgetting to use 'new' is really the only thing I could think of that makes this pattern dangerous.