Possible Duplicate:
What’s the difference between “Array()” and “[]” while declaring a JavaScript array?
var all = [];
var all = new Array();
What is the difference between these two definitions? I can't make them clear.
Possible Duplicate:
What’s the difference between “Array()” and “[]” while declaring a JavaScript array?
var all = [];
var all = new Array();
What is the difference between these two definitions? I can't make them clear.
There is no difference. But best practice is to avoid using new
on JavaScript primitive types.