Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRonald Jefferson
5,115 PointsQuestion on final quiz for Objects, Arrays, and Loops had the wrong answer. A 2 Dimensional Array IS an array of Objects
There was a true/false question that asked if a two dimensional array was an array of objects. I marked true, that a 2-Dimensional array IS an array of objects and the course said I was wrong. I disagree because an Array itself is an Object because it has attributes and functions which meets the qualifications to be an Object. Also MDN has this to say about an Array; "The JavaScript Array object is a global object that is used in the construction of arrays; which are high-level, list-like objects." Someone on tree house needs to make this update. I rest my case.
2 Answers
Manish Giri
16,266 PointsAn array of objects would be -
[{name: "John Doe", age: 20}, {name: "Jane Doe", age: 15}]
A 2D array is an array of arrays, where each individual array can be any collection of items (objects, or primitives) -
[[1,2,3], [5, true]]
The question is right, and it provides the explanation too -
Well done! A two-dimensional array is an array, where each item in the array is another array.
It's not asking what arrays are under the hood. Changing it to true would be misleading.
Ronald Jefferson
5,115 PointsI understand the syntax of an array or arrays versus an array of Objects. My point is an Array is itself an Object, therefore a 2 dimensional array IS an Array of Objects. A 2-dimensional array is also an array of arrays so the explanation is not wrong. But just because the explanation is right doesn't mean it cannot also be an Array of Objects. Changing it to true would be correct, not misleading.