Many people say that you should avoid new Object, new Array()and instead use {}. [], and true/false.
What are the benefits of using the literal constructs to get a
In most cases an object literal or array literal is sufficient and easier to use. You can even call or apply prototype methods (e.g. [].prototype.slice.call(someObj)) It's mostly faster too.
You'll may want to notice that {} and []‘s constructor cannot be overwritten and that
Object
and Array
are constructors where {} and [] are instances.