Javascript 1.9.3 / ECMAScript 5 introduces Object.create, which Douglas Crockford amongst others has been advocating for a long time. How do I replace new
Object.create() is a Javascript function which takes 2 arguments and returns a new object. const proto = {
talk : () => console.log('hi')
}
const props = {
age: {
writable: true,
configurable: true,
value: 26
}
}
let Person = Object.create(proto, props)
console.log(Person.age);
Person.talk();
new keyword you have no control over this (however, you can overwrite them of course).new keyword invokes a constructor function. With Object.create() there is no need for invoking or even declaring a constructor function.