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) Storing and Tracking Information with Variables Review JavaScript Variables

phil pettit
phil pettit
1,261 Points

why is this answer incorrect?

var score = '100';

7 Answers

Jeff Lemay
Jeff Lemay
14,268 Points

The answer is 100 with no quotes around it. Nowhere in the question do they ask you to add a string, they say "store the value of 100" in the variable.

Jeff Lemay
Jeff Lemay
14,268 Points

Integers don't need to be wrapped in 'quotes'. Quotes are for strings of text.

It's because you entered 100 as a string not an integer. Strings have single or double quotes around them integers do not.

phil pettit
phil pettit
1,261 Points

Thanks, it was just confusing because of the previous question - "Which of the following is an example of a string?" the correct answer was C '1800' using quotes. I get it, I am just saying the quiz could be a little more helpful because it doesn't let you know why it was incorrect.

phil pettit
phil pettit
1,261 Points

Thank you, I understand, but the question in the quiz said to add the "string value of 100 to the variable name score" in the previous question the correct answer from the multiple choice for a proper string was '1800' in quotes...

Jeff Lemay
Jeff Lemay
14,268 Points

So like this...?

score += '100';
phil pettit
phil pettit
1,261 Points

It was a fill in the blank ie: "var score = ____________"

phil pettit
phil pettit
1,261 Points

I just think it would be a lot more helpful if the correct answer would be shown if I give an incorrect answer.