[Javascript] Literal array declarations

Philip Thompson philthathril at gmail.com
Thu Oct 29 14:01:53 CDT 2009


Hi all.

I ran across http://www.jslint.com/ and had it evaluate my code. One  
of the things it suggested was to "Use the array literal notation []."  
So, I had:

var anArray = new Array();

and JSLint wants me to do:

var anArray = [];

Well, I'm curious... why is the literal declaration preferred?

Thanks,
~Philip



More information about the Javascript mailing list