JSLint and JSHint (before version 1.0.0) will throw the "Use the object literal notation {}" error when they encounter a call to the Object constructor preceded by the new operator. Here's an example:
This error is raised to highlight a potentially dangerous and unnecessarily verbose piece of code. Before we look at why that above snippet is potentially dangerous, here's a rewritten version using array literal notation that passes JSLint and JSHint. Notice that it's significantly shorter:
Since the Object constructor is actually just a property of the global object, it can be overwritten. If it has been overwritten, then it's possible the first example above will generate a type error. For example, if you had run something like Object = 50, a type error would be thrown because Object is no longer a function.
Here's an example in which we overwrite the Object constructor. Note that JSLint and JSHint do not know that's what has happened. Therefore, they take the safe approach and forbid the use of the Object constructor completely:
Always using the literal form prevents running into problems like this, however unlikely they may be. Note that the literal form is identical to the constructor form (ES5 §11.1.5):
The production ObjectLiteral : { } is evaluated as follows:
1. Return a new object created as if by the expression new Object() ...
In JSHint 1.0.0 and above this warning has changed to "The object literal notation {} is preferrable". More detail can be found the page dedicated to that message.