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 The Solution

Hannah Eichelsdoerfer
Hannah Eichelsdoerfer
4,042 Points

Blank page after I add the alert like in the video

My problem is that the console says: "Uncaught SyntaxError: missing ) after argument list"

var name = prompt("Whats your name?");

var hometown = prompt("Where are you from?");

var nameAndHometown = name.toUpperCase() + ' ' + hometown.toUpperCase();

var characterCount = nameAndHometown.length;

alert("The string \"" + nameAndHometown + "\" is + characterCount + " characters long.");

Everything works till I add the alert - but thats how he writes the code in the video right?

1 Answer

Your last line has a small syntax error that breaks the alert part of your code. The string " is is missing its closing quotes. It's your second string, or the string immediately following nameAndHomeTown.

Fixed below:

alert("The string \"" + nameAndHometown + "\" is" + characterCount + " characters long.");