0

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.

0

1 Answer 1

0

There is no difference. But best practice is to avoid using new on JavaScript primitive types.

Sign up to request clarification or add additional context in comments.

2 Comments

There is a difference, please read the linked question.
For example: var all =[]; var all1= new Array(); the all1[2] may have undefined type, but variable all is always blank string, is it?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.