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

Challenge: A different mistake is shown in my Javascript Console.

I downloaded project files with the 1st challenge. To my surprise, when I opened it in my browser window and used JavaScript console, a different mistake was displayed. Instead of the expected

“Uncaught SyntaxError: Unexpected identifier (scripts.js:2)” message AS in DAVE'S VIDEO, I got a

“SyntaxError: missing ) after argument list (scripts.js:2)” message both in Chrome and FireFox. It’s not my code - it’s the code I downloaded:

alert("Help me fix this program!");

alert(Can you get this message to appear?);

FF: SyntaxError: missing ) after argument list (scripts.js:2:10). Apparently, it wants me to add ) after "Can": alert(Can) you get this message to appear?);

Is anyone else getting the same error message as mine in your console? Any ideas why does my Javascript console perform differently? Thank you.

After this challenge I came into conclusion that

a) You can't rely on debuggers too much.

b) FireFox console is sort of better. It gives you not only a line number but also an exact position of a “mistake” in that line.

3 Answers

The answer that I think you are looking for is: There seem to often be differences between the downloadable code and the code used in the video. The code in the video is similar to the code that will appear in the launch-able workspace where the line was missing both quotation marks and was considered a identifier problem. The downloadable code was only missing one quotation mark. A single missing quotation mark means that javascript was making the rest of the line into a string including the ) closing bracket. So js seeing a ( opening bracket and no closing bracket, it gave you a syntax error.

Thanks, Ryan for your detailed response!

I'm not sure about that, I just got an "unexpected identifier" error message. I wouldn't worry about that too much either way. Do you see the error in the code? It is missing a pair of quotes on the second alert message.

Thank you. Yes, I see the obvious error. But my question is about a different outcome in JavaScript console.

I see, sorry about that. I'm not sure why you're getting a different error message. :(

Thank you anyway, Cameron. I appreciate that you were trying to help me.

:)

Roland Johnson
Roland Johnson
39,580 Points

I don 't know if i'm misreading the question. The only problem I see is quotations are missing before Can and after the ? The code should be alert("Can you get this message to appear?");

Thank you. But the question is about different error messages in console. Did you get the same message as Dave got in his video or mine?