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 The Build an Object Challenge, Part 2

Erin Palchak
Erin Palchak
3,239 Points

Source Code Discrepancy?

Hey everyone, In the source code we're given for this challenge, the properties achievements and points both have numbers as values. But for the other four students the properties achievements and points are given strings as values. Was this intentional? Should all the values in this challenge be strings? Or should the numeric strings be numbers?

It struck me as odd that the formatting wouldn't be the same across all five objects, although the source code we are given is exactly how he wrote it in the video. Thanks in advance.

1 Answer

Steven Parker
Steven Parker
229,732 Points

I remember thinking that was odd when I took this course. But it does not cause any trouble since the only thing the demo program does is display the data. If it were to do math on it, that would cause an issue.

I'd bet the format deviation was unintentional, and overlooked because it did not affect the outcome. In a real-world situation, I would expect to store the numeric values consistently as numbers.