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

2-D Array vs Object literals for multiple choice

Is it possible to ask multiple choice questions using a 2-d array?

3 Answers

My understanding of a 2-D array is that it wouldn't actually 'do' anything. An array is an object, you're maybe looking for a method (like a function for example)? Anyway, I'm not super experienced at js, but that's my understanding thus far.

I'm pretty sure you can have a method call a 2-D array, though I'm not sure which is generally more useful, the 2-D array, or the object literal.

Jason Desiderio
Jason Desiderio
21,811 Points

It is definitely possible to store the information for multiple choice questions in a 2D array. The more crucial part is how you access and process that information with a function to display it on the page.

Yeah that makes sense, not how you store it but how you access it.

Thank You Both!!