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 Create a variable with a string

It's right but it's wrong.

I have noticed a few times while using workspace and while taking the challenges that it comes up with errors or when I go to check work it says my answer is wrong. for example when asked to create player with string Jasmine I put, var player = "Jasmine"; , and the answer came up as correct. The next question asks to create a document.write message displaying that variable so I write, document.write(Jasmine);. Before I can check my work I realize that it is not correct and I just backspace through the part that says Jasmine and replace it with player so that the line says, document.write(player); then check my work. It comes up say that not only is it wrong, but the answer to the first question is now wrong, and reverts me back to the first question. My original line of code was still saved there so I click on check work and it says the answer is right and takes me to the next question. Once again my original answer to the second question is saved there on line 2. So I delete it and retype it exactly it it had just read, document.write(player); , and it says that it is correct. Is anyone else having this problem?

1 Answer

Steven Parker
Steven Parker
231,248 Points

You might have had a typo the first time.

When you backspaced and made the correction the first time, there may have been a typo on the line you didn't notice. That typo may have created a syntax error that caused the entire script to seem invalid, and since task 1 is retested first, that would explain the message you got.