JSLint is giving me this error:
Problem at line 11 character 33: Use the array literal notation [].
var myArray = new Array();
What is array literal notation and why does it want me to use it instead?
It shows here that new Array(); should work fine… is there something I’m missing?
array literal notation is where you define a new array using just empty brackets. In your example:
It is the “new” way of defining arrays, and I suppose it is shorter/cleaner.
The examples below explain the difference between them: