0
I started using the Jshint in my projects, together with the Sublime Linter (which, by the way, I recommend). After doing the setup I came across the following warning::
The literal array Notation is preferable
in a statement of the type:
var myArray = new Array();
Of course this is easily bypassed with:
var myArray = [];
I remember reading some reports about the performance of one or another notation, but nothing very concrete. I also read that at ES6, both would have exactly the same functionality. The question (or questions) is:
- What is the difference between the ratings?
- There is, in practical terms, a difference in performance between them?
- There are edge cases where only one of the two would be the right one?
- Which to use, after all?
Would that be? What is the difference between declaring an array with "array" and "[]" in Javascript?
– rray
@rray possibly. and look what I searched before opening the question
– Caio Felipe Pereira