+4  A: 

One is good and the other is bad :-)

No seriously, the first way is shorter (fewer bytes sent over the wire) and it doesn't have any weird potential problems. The second one, however, will work fine.

The weird part with new Array() is this: if you pass one numeric parameter to the constructor, it means "initialize the array so that there are that there are the given number of empty (null) array elements, and so that length is equal to the given number." (Well it has to be an integer, I think actually.) If you pass a single non-number, or two or more numbers, it means, "initialize the array so that its contents reflect this argument list."

Ok now I said there was a weird part, and it's this: if you're using some sort of server side framework, and you want to create an array of numeric values (integer values), like say unique database keys, then you might be tempted to do this:

var keys = new Array(<@ favoriteTemplateLanguage.forEach(idList): print(id + ',') @>);

(I made up that syntax of course.) Now what happens if there's just one "id" in your server-side list of keys?

Pointy
Yes don't over work the wires!
Jonathan Park
@Pointy... so which one is good and which one is bad? It seems like you complimented both...
Hristo
I was kidding about the "bad" part, but in my opinion the first notation ([]) is preferable because it's less quirky.
Pointy
It has be an *unsigned* integer, to be more precise, see the [ECMAScript spec](http://ecma262-5.com/ELS5_Section_15.htm#Section_15.4.2.2): “If the argument *len* is a Number and ToUint32(*len*) is equal to *len*, then the **length** property of the newly constructed object is set to ToUint32(*len*). If the argument *len* is a Number and ToUint32(*len*) is not equal to *len*, a **RangeError** exception is thrown.”
Marcel Korpel
Yes, I read that the other day on kangax's blog - that's all correct. I don't ever use the `new Array()` form so I don't think about it too much :-)
Pointy
+1  A: 

none what so ever. Both create a new instance of an Array object.

Douglas Crockford in 'Javascript the good parts' recommends the former method as it is more concise.

Gareth Davis
Crockford also discourages the use of `++` and `--` for some obscure reason…
Marcel Korpel
+2  A: 

You can use the second one to define an array of a predefined length, e.g.

var arrayListAgain = new Array(20);

will create an array with 20 (undefined) elements.

Also see new Array (len).

Marcel Korpel
+1  A: 

They are the same. According to http://www.hunlock.com/blogs/Mastering_Javascript_Arrays:

Current best-practice eschews the "new" keyword on Javascript primitives. If you want to create a new Array simply use brackets [] like this… var myArray = [];

I recommend reading that page, it contains a lot of useful information about arrays and JS in general.

dark_charlie