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
177,602 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.