-1

is this:

var arr = {};

the same as

var arr = new Array();

?

5 Answers 5

7

It is not the same.

var arr = {};

initializes an object. If you want an array:

var arr = [];
1
4

not exactly. var arr = []; is more like it.

2

No.

var arr = {}; // creates a new object with no properties

But

var arr = []; // creates a new blank array
1

var arr = {}; creates object

1

No, it's not: You're confusing array literals

var arr = []; // same as new Array()

with object literals

var obj = {}; // same as new Object()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.