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 trialsenay yakut
4,124 Pointsjavascript
which of the following stores the number 225,622 in the variable milesToTheMoon? A - var milesToTheMoon ='225622'; B- var milesToTheMoon=225622; C- var milesToTheMoon=225,622;
I assume I am giving the right answer but it doesn't work
4 Answers
Alexander Davison
65,469 PointsIt's actually B, not C. This is because JavaScript is picky, and JavaScript doesn't except commas inside of numbers. Commas ar enot allowed in numbers, in other words. B looks just like C, but without those commas.
Note: You can always press Command and Shift and i at the same time (on Mac) or Ctrl and Shift and i (on Windows) to open up the JavaScript console to write JavaScript.
senay yakut
4,124 PointsI am thinking C is the right one
senay yakut
4,124 Pointsthanks !
Alexander Davison
65,469 PointsYou're welcome! :)
Ali .
15,521 Pointsanswer is : var milesToTheMoon=225622;