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 trialKirt Perez
7,374 PointsQuestion not related to the challenge, but when do we use arrays versus objects?
From the title, I'm trying to figure out use cases for both that distinctively has its pros from one another.
1 Answer
Adam N
70,280 PointsI like this quote from this page:
If itβs a single entity with named properties, you want an object. If itβs a group of entities of the same type/shape, or if order matters, you likely want an array.
Let me know if this helps!
Kathy Tavia
7,234 PointsKathy Tavia
7,234 PointsI believe arrays are more used for a list of related items (shopping list, list of ages, list of fruits). However, objects are better for listing different data types pertaining to one subject (person has a name, age, address, height, etc). I hope that makes sense!