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 trialJessaly Sinchico
909 Points"Uncaught SyntaxError: Identifier 'message' has already been declared"
const name = prompt("What is your name?");
const message = "Hello " + name;
console.log(message);
I'm following the video instructions, but for some reason is telling me that there is a SyntaxError. Please help.
2 Answers
Jamie Reardon
Treehouse Project ReviewerJessaly Sinchico the current code you have in your question is valid. The error is specific in the context that it means that you are trying to redeclare a const
variable, which you can't do. Double check the video's code line for line. Notice how the teacher changes the keyword const
to let
to allow reassignment.
Nicole Buckenwolf
8,721 PointsJust finish the video - he addresses this
Gabriela Miranda
435 PointsI fisished, though it still not working.
const name = prompt("whats is yor name");
let message = "Hello " + name;
conole.log(message);
The word "Hello" dos not apear.
Rich Donnellan
Treehouse Moderator 27,708 PointsRich Donnellan
Treehouse Moderator 27,708 PointsQuestion updated with code formatting. Check out the Markdown Cheatsheet below the Add an Answer submission for syntax examples, or choose Edit Question from the three dots next to Add Comment to see how I improved the readability.