Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Question

removed noise
Source Link
JJJ
  • 33.2k
  • 20
  • 95
  • 103

I've been monkeying with Javascript for several years now (since backAre arrays merely objects in the day before Gmail, Facebook, and YouTube, if you believe such a day existeddisguise? Why/why not? In what way(s). Big high-five to Thau.

My are they Question, as such:

Are arrays merely objects in disguise? Why/Why not? In what way(s) are they (such/not)?(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 = ['you':'them']; // see edit

EDIT: As Matti pointed out, the proper syntax is... (and I have always found this tiresome syntax)

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...?

EDIT In fact, probably a better question:

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

EDIT

Great responses; more than I hoped for, that's for sure. I can honestly say I learned something from each answer given, and that all attempted to impart knowledge and wisdom.

Each answer gave different pieces of the picture, and not provided the entire picture I was looking for. However, I selected Šime Vidas' answer, since I think it is the clearest, most succinct answer with references to review. Thanks Šime.

All the others that I thought provided valid responses, I provided a vote. There were several that could have easily been selected as the answer, so I hope anyone Are arrays/objects merely strings in the future that comes across this question will read all of the answers, since there is good information available.

Thanks!

Jareddisguise? Why/why not? In what way(s) are they (such/not)?

I've been monkeying with Javascript for several years now (since back in the day before Gmail, Facebook, and YouTube, if you believe such a day existed). Big high-five to Thau.

My Question, as such:

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 = ['you':'them']; // see edit

EDIT: As Matti pointed out, the proper syntax is... (and I have always found this tiresome syntax)

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...?

EDIT In fact, probably a better question:

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

EDIT

Great responses; more than I hoped for, that's for sure. I can honestly say I learned something from each answer given, and that all attempted to impart knowledge and wisdom.

Each answer gave different pieces of the picture, and not provided the entire picture I was looking for. However, I selected Šime Vidas' answer, since I think it is the clearest, most succinct answer with references to review. Thanks Šime.

All the others that I thought provided valid responses, I provided a vote. There were several that could have easily been selected as the answer, so I hope anyone in the future that comes across this question will read all of the answers, since there is good information available.

Thanks!

Jared

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)?

added 413 characters in body
Source Link
Jared Farrish
  • 49.4k
  • 17
  • 100
  • 108

I've been monkeying with Javascript for several years now (since back in the day before Gmail, Facebook, and YouTube, if you believe such a day existed). Big high-five to Thau.

My Question, as such:

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 = ['you':'them']; // see edit

EDIT: As Matti pointed out, the proper syntax is... (and I have always found this tiresome syntax)

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...?

EDIT In fact, probably a better question:

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

EDIT

Great responses; more than I hoped for, that's for sure. I can honestly say I learned something from each answer given, and that all attempted to impart knowledge and wisdom.

I'll need to sleep onEach answer gave different pieces of the picture, and not provided the entire picture I was looking for. However, I selected Šime Vidas' answer, since I think it is the clearest, most succinct answer with references to determine anreview. Thanks Šime.

All the others that I thought provided valid responses, I provided a vote. There were several that could have easily been selected as the answer, butso I do believe onehope anyone in the future that comes across this question will read all of the answers, since there is below. Let's see what tomorrow bringsgood information available.

Thanks!

Jared

I've been monkeying with Javascript for several years now (since back in the day before Gmail, Facebook, and YouTube, if you believe such a day existed). Big high-five to Thau.

My Question, as such:

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 = ['you':'them']; // see edit

EDIT: As Matti pointed out, the proper syntax is... (and I have always found this tiresome syntax)

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...?

EDIT In fact, probably a better question:

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

EDIT

Great responses; more than I hoped for, that's for sure. I can honestly say I learned something from each answer given, and that all attempted to impart knowledge and wisdom.

I'll need to sleep on it to determine an answer, but I do believe one is below. Let's see what tomorrow brings.

Thanks!

Jared

I've been monkeying with Javascript for several years now (since back in the day before Gmail, Facebook, and YouTube, if you believe such a day existed). Big high-five to Thau.

My Question, as such:

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 = ['you':'them']; // see edit

EDIT: As Matti pointed out, the proper syntax is... (and I have always found this tiresome syntax)

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...?

EDIT In fact, probably a better question:

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

EDIT

Great responses; more than I hoped for, that's for sure. I can honestly say I learned something from each answer given, and that all attempted to impart knowledge and wisdom.

Each answer gave different pieces of the picture, and not provided the entire picture I was looking for. However, I selected Šime Vidas' answer, since I think it is the clearest, most succinct answer with references to review. Thanks Šime.

All the others that I thought provided valid responses, I provided a vote. There were several that could have easily been selected as the answer, so I hope anyone in the future that comes across this question will read all of the answers, since there is good information available.

Thanks!

Jared

added 304 characters in body; added 1 characters in body
Source Link
Jared Farrish
  • 49.4k
  • 17
  • 100
  • 108

I've been monkeying with Javascript for several years now (since back in the day before Gmail, Facebook, and YouTube, if you believe such a day existed). Big high-five to Thau.

My Question, as such:

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 = ['you':'them']; // see edit

EDIT: As Matti pointed out, the proper syntax is... (and I have always found this tiresome syntax)

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...?

EDIT In fact, probably a better question:

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

EDIT

Great responses; more than I hoped for, that's for sure. I can honestly say I learned something from each answer given, and that all attempted to impart knowledge and wisdom.

I'll need to sleep on it to determine an answer, but I do believe one is below. Let's see what tomorrow brings.

Thanks!

Jared

I've been monkeying with Javascript for several years now (since back in the day before Gmail, Facebook, and YouTube, if you believe such a day existed). Big high-five to Thau.

My Question, as such:

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 = ['you':'them']; // see edit

EDIT: As Matti pointed out, the proper syntax is... (and I have always found this tiresome syntax)

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...?

EDIT In fact, probably a better question:

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

Thanks!

Jared

I've been monkeying with Javascript for several years now (since back in the day before Gmail, Facebook, and YouTube, if you believe such a day existed). Big high-five to Thau.

My Question, as such:

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 = ['you':'them']; // see edit

EDIT: As Matti pointed out, the proper syntax is... (and I have always found this tiresome syntax)

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...?

EDIT In fact, probably a better question:

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

EDIT

Great responses; more than I hoped for, that's for sure. I can honestly say I learned something from each answer given, and that all attempted to impart knowledge and wisdom.

I'll need to sleep on it to determine an answer, but I do believe one is below. Let's see what tomorrow brings.

Thanks!

Jared

added 152 characters in body
Source Link
Jared Farrish
  • 49.4k
  • 17
  • 100
  • 108
Loading
added 124 characters in body; added 4 characters in body; added 65 characters in body; added 2 characters in body; deleted 1 characters in body
Source Link
Jared Farrish
  • 49.4k
  • 17
  • 100
  • 108
Loading
Source Link
Jared Farrish
  • 49.4k
  • 17
  • 100
  • 108
Loading
lang-js

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