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) Introducing JavaScript The Console Challenge Answer

Lotte Bloem
Lotte Bloem
18,630 Points

I still get a error, what am i doing wrong?

It says i miss the " " in line 2. And when i delete that hole line, it's still giving me that error!

alert("Help me fix this program!");
alert("Can you get this message to appear?");
document.write("<h2>My first JavaScript program</h2>");
document.write("<p>I'm practicing 'debugging'.</p>");
Bobby Verlaan
Bobby Verlaan
29,538 Points

Hehe. Creative brief! Could you please add your code as well? Then we can look into what the problem might be. Chances are you have missed the ; symbol on line 1.

3 Answers

Lotte Bloem
Lotte Bloem
18,630 Points

Hi Bobby, this is my first time that i use this forum. Can you please explain how i can add the code in here?

Konrad Pilch
Konrad Pilch
2,435 Points

A fast thingy I did for you is here your look beautiful as well.

Bobby Verlaan
Bobby Verlaan
29,538 Points

I see the end of the message wasn't the creative part, but the actual code you wrote that makes the error! With the markup added now I can read it :-). Looks like Nejc already got you covered! Escaping with \ should work. Keep in mind that double quotes and single quote can be used together as long as they are inside eachother:

  • " hello you're good " <-- good
  • ' hello you're good' <-- bad

To test Nejc advice. Create a .html file on your computer, edit it with notepad (or other texteditor), save your code in the document and open up the html in your own environment. As far as I can see that should work :-)

Konrad Pilch
Konrad Pilch
2,435 Points

There are few sublime text editors like sublimetext2/3 , brackets, coda, notepad++ and so on. I recommend to set the screen on black background, it will save your eyes in long term .

Hi as you have written the code looks fine and I think the debugger is giving a false error:

//this is your line
document.write("I'm practicing 'debugging'."); 

//use this instead
document.write("I\'m practicing 'debugging'.");
//the ' should be escaped -> "I\'m ...

If I'm not mistaken then this could be a problem -> You have to look at it like this -> the ' in I'm opens a string literal and hte second ' at 'debugging closes it and then debugging' opens another string literal that isn't closed.

You should use an escape character for the ( I'm ) like I have written in the code above.

Try it and give some feedback.

Happy Coding!!!

Lotte Bloem
Lotte Bloem
18,630 Points

Ah tnx guys! it's works now!