Revision 30c6492e-c28b-429a-a86a-415c195be409 - Stack Overflow

Are arrays merely objects in disguise? Why/why not? In what way(s) are they (such/not)?

I have always thought of arrays and objects in JS as essentially the same, primarily because accessing them is identical.

 var obj = {'I': 'me'};
 var arr = new Array();
 arr['you'] = 'them';

 console.log(obj.I);
 console.log(arr.you);
 console.log(obj['I']);
 console.log(arr['you']);

Am I mislead/mistaken/wrong? What do I need to know about JS literals, primitives, and strings/objects/arrays/etc...?

Are arrays/objects merely strings in disguise? Why/why not? In what way(s) are they (such/not)?

AltStyle によって変換されたページ (->オリジナル) /