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

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!