Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
216,810 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.