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 trial

JavaScript JavaScript Loops, Arrays and Objects Tracking Data Using Objects Review Loops, Arrays, and Objects

Quiz question: "A two-dimensional array is an array of objects."

The question: "A two-dimensional array is an array of objects." should be true in my opinion. An array of arrays is technically an array of objects... just a specific type of object. The quiz thinks the correct answer is false. At the very least, this is confusing since it insinuates that the arrays within an array are not objects in and of themselves.

1 Answer

Marcus Eley
Marcus Eley
16,213 Points

Hello Brock,

I believe that the reason it is stating that the answer is false is because the data in a two dimensional array is not restricted to only arrays or objects. For example you could have an array like array1 = [ array2, array3, 'a', 12]. In which case your array contains a char and an int, which no longer fits the description in question.

I hope that makes sense.

Marcus

Hi Marcus Eley,

That makes sense I think... however wouldn't a two-dimensional array, by definition, be only an array of arrays with no other data types?

So for example...

array = [ array1, array2, array3, ..... arrayX]

I guess you could say that array2 and array3 are two-dimensional arrays in and of themselves in your example... but when I'm speaking with someone about a two-dimensional array... I think it's a reasonable assumption that we're both not talking about an array filled with a few arrays here and there... and also a few simple data types like ints and chars. I apologize if I'm still misunderstanding.