0

When defining data schemas in JavaScript and nesting the data inside arrays or objects what's the main advantage of choosing one over another ?

Does nesting objects inside an array have a different effect then nesting arrays inside objects ?

Is it arbitrary choosing one to nest the other inside or rather is it done quite on purpose in some cases ?

The question arose upon reading the fourth chapter of eloquent JavaScript.

Quentin
  • 62,093
  • 7
  • 131
  • 191
Ozan
  • 1,623
  • 3
  • 13
  • 25
  • Do you need a list of values (array) or something more complicated such as named keys (object)? – ggdx Apr 25 '17 at 13:50
  • @DanWhite That's correct. However I am not asking the difference between those two. Rather, my question is about effects of those two practises in use. – Ozan Apr 25 '17 at 13:54
  • They are two different things for two different jobs. Like asking what's the difference between a string and an integer. You can have an array of objects and an object key value as an array. – ggdx Apr 25 '17 at 14:00

0 Answers0