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 trialkdouglas
218 PointsDid the syntax coding change since the video has been produced? I copied the code exactly as the "here's my solution". ?
I have a blank screen, no prompts... Then I notice others changing the format to using $ and {} so here's what I have...
var firstName = prompt("What is your first name?");
var lastName = prompt("What is your last name?");
var completeName = FirstName.toUpperCase()+ ' ' + lastName.toUpperCase();
var characterCount = completeName.length;
alert('The String $ {completeName} is $ {characterCount} characters long.');
edited to add markdown and changed category from Java to JavaScript
1 Answer
Jennifer Nordell
Treehouse TeacherHi there, Gypsy Miles! There are a couple of things going on here. First, the variable FirstName
is not defined which is why nothing is showing.
You currently have this:
var completeName = FirstName.toUpperCase()+ ' ' + lastName.toUpperCase();
But you meant:
var completeName = firstName.toUpperCase()+ ' ' + lastName.toUpperCase();
Finally, your template literal contains single quotes instead of backticks. The backticks are incredibly important and there should not be spaces between the dollar signs and the curly braces.
So where you have this:
alert('The String $ {completeName} is $ {characterCount} characters long.');
That should be:
alert(`The String ${completeName} is ${characterCount} characters long.`);
Hope this helps!
kdouglas
218 Pointskdouglas
218 PointsThank you! I didn't know what backticks were, just found it on the keyboard. This practice is also requested before learning what String are and how to do, no the less I am learning so much... Once completed with the Strings lesson, I'll come back to redo the practice. Cheers!