JSLint and JSHint (before version 1.0.0) will throw the "Use the array literal notation []" error when they encounter a call to the Array constructor with 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 Array 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 Array = 50, a type error would be thrown because Array is no longer a function.
Here's an example in which we overwrite the Array constructor. Note that JSLint and JSHint do not know that's what has happened. Therefore, they take the safe approach and forbids the of the Array constructor completely:
In JSHint 1.0.0 and above this warning has changed to "The array literal notation [] is preferrable". More detail can be found the page dedicated to that message.