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 trialGedeon Bashimbe
1,026 PointsHere is my code https://w.trhou.se/id7oj1wtbq I can't get anything to pop on the preview not sure what is wrong.
Here is my code https://w.trhou.se/id7oj1wtbq I can't get anything to pop on the preview not sure what is wrong.
3 Answers
Auroiah Morgan
17,799 PointsI gave this a try using String.concat() (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/concat)
cuts down on all the "" and + you would have to use but required some research the video doesn't cover it but does suggest looking at the MDN site. I came across that just scrolling and 'DING' :)
var favColor = prompt('What is your favorite color?');
var favIngredient = prompt('What is your favorite ingredient?');
var count = favColor.length + favIngredient.length;
var upperCase = favColor.toUpperCase() + " and " + favIngredient.toUpperCase();
alert(upperCase.concat(' has ', count, ' letters in it.'));
KRIS NIKOLAISEN
54,971 PointsYour alert uses variable characterCount but this hasn't been declared or assigned a value. I modified your code as follows:
var firstName = prompt("What is your first name");
var lastName = prompt("What is your last name");
var fullName = firstName.toUpperCase() + ' ' +lastName.toUpperCase();
var characterCount = fullName.length;
alert("the string " + fullName + " is " + characterCount + " characters long.");
Gedeon Bashimbe
1,026 Pointsok thanks alot