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 Basics (Retired) Working With Numbers Review Numbers

Taya Shoub
Taya Shoub
2,621 Points

All wrong answers

There is no correct answer to this question. A. contains a comma B. the value is a string, not a number C. contains wrong number (integer instead of decimal).

Dane Parchment
Dane Parchment
Treehouse Moderator 11,077 Points

Can you please specify the question? I just took the quiz again to see what you had problems with, and I got them all right, so tell me the question so that I can help you solve it.

1 Answer

Dane Parchment
MOD
Dane Parchment
Treehouse Moderator 11,077 Points

Do you mean this question?

Which of the following stores the number 225,622 in the variable milesToTheMoon?

  1. var milesToTheMoon=225622;
  2. var milesToTheMoon='225622';
  3. var milesToTheMoon=225,622;

Ok if it is this question, then the answer is 1 (or whatever letter matches this answer).

The 2nd one is a string The 3rd one uses the wrong syntax and would result in an error.

Taya Shoub
Taya Shoub
2,621 Points

Yep, the test matches answer 1 as the correct one, but actually it isn't. It's just a typo, but, you know, it would be good if someone fixed it :)

What do you mean it isn't the correct answer? The number in the question isn't a decimal. That comma is just a thousands separator. But yeah it's bit confusing I guess.

Dane Parchment
Dane Parchment
Treehouse Moderator 11,077 Points

I think the comma in the number 225,622 is throwing you off. There is no typo anywhere, the mathematical representation of two hundred twenty five thousand six hundred and twenty two is 225,622 including the comma separator. However, in computer science, there is no decimal because we are just showing the number do to syntactical reasons, so no comma included.

225,622 == 225622

225,622 - Our mathematical way of writing the number 225622 - The computer's way of reading the number, because of syntax reasons. Basically a comma has special meanings in programming languages and as such it would be near impossible for an interpreter to find the differentiate:

sum(100,85)

From meaning 100 + 85, or 100,85

Do you understand now why there is no typos anywhere.