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 1 Solution

Arikaturika Tumojenko
Arikaturika Tumojenko
8,897 Points

Why using quotes when writing the values represented by numbers?

I noticed Dave didn't use quotes when the wrote down the achievements and points values for the first object, but he used for the rest. Why?

2 Answers

Craig Watson
Craig Watson
27,930 Points

Hi,

I am assuming this is something that has been overlooked when typing out the object quickly. You can wrap numbers in a JSON object in quotes, that is not a problem at all, the problem lies with the fact it has been stored as a string and not a number.

Check the below post for a little example.

http://stackoverflow.com/questions/15368231/can-json-numbers-be-quoted

Craig

Arikaturika Tumojenko
Arikaturika Tumojenko
8,897 Points

Thx, Craig. I don't see how this is this going to change the result of this challenge in particular, but I think for someone who's learning JS the different notation can be confusing.

Thank you. Thought the same thing. Greetings!