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
Jason Hill
Full Stack JavaScript Techdegree Student 11,399 PointsHere's what I came up with. Any advice on making is cleaner or more efficient?
var firstName = prompt("What is your first name?");
var lastName = prompt("What is your last name?");
var result = firstName.toUpperCase() + lastName.toUpperCase();
var length = firstName.length + lastName.length;
alert("The string " + result + " is " + length + " characters long.");
2 Answers
<noob />
17,063 PointsYou can use template literals.
alert(`The string ${result} is ${length} characters long.`);
and u can lower and upper case in the prompts
var firstName = prompt("What is your first name?").toUpperCase();
var lastName = prompt("What is your last name?").to;LowerCase();
Jason Hill
Full Stack JavaScript Techdegree Student 11,399 PointsAh I like the upper and lower case in the prompts. Template literals I had no idea what they were until now, thanks for that! I'm trying to keep learning and pushing things outside the box a bit. Wrapping my head around beginning to think like a software engineer/problem solving manner that is most efficient or elegant. Being an electrician, I do this a lot with lighting controls for instance, but my problems usually are engineered out to a degree, so I have starting points. Thanks again!