Since when is new not recommended? D. Crockford has the right point of view and strong opinion, but new is part of the language, and it is very used in many projects. new is part of the prototype inheritance model and should be used to create new instances using the constructor function. Crockford points to a purely functional approach, using the this and return this contexts to be able to inherit properties and methods between child objects. This is another solution to the general problem, but that does not mean that new should not be used. In fact, one of the most copied / pasted JS snippets of all time is Crockford's, object.create polyfill, and it uses new :
if (typeof Object.create !== 'function') { Object.create = function (o) { function F() {} F.prototype = o; return new F(); }; }
source share