I've been talking to some professionals who work with JavaScript in a company, and I've been told that it isn't a good practice to create an object instance using either new
or the global object {}
, even if I want an empty object, like this:
var wrong1 = new Object();
var wrong2 = {};
The correct way, according to them and the company's standards, is to create it like this:
var correct = Object.create({});
Passing an empty object as the prototype of an empty object seems rather over-engineered, and maybe even purposeless.
Can someone provide me an answer as to why this is recommended, or if it isn't, why not? (possible pros. and cons.)