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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Melissa Ferguson](https://secure.gravatar.com/avatar/ed33e9dc3c7b00ba1810decf73df8e11?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Melissa Ferguson
8,274 Pointsplease help with my code. its not working.
Im not sure why my below code is not working. what did i do wrong?
const question1 = prompt("What is your first name?"); const question2 = prompt("What is your last name?");
let answer = question1.toUpperCase() -'' + question2.toUpperCase();
let number = answer.length();
alert(The string ${answer} is ${number} of characters long
);
2 Answers
![kols](https://uploads.teamtreehouse.com/production/profile-photos/1206722/micro_Screen_Shot_2016-09-13_at_6.55.30_PM.jpg)
kols
27,007 PointsHi, Melissa — from the provided code, it looks like you've got just a few minor issues here...
1) In this line of code, it appears like you've made a small syntax error. If you're using concatenation to build up this particular string, you would need to change that -
symbol out for a +
symbol and add a space between the quotation marks. Here's what it would look like updated:
let answer = question1.toUpperCase() + " " + question2.toUpperCase();
2) Secondly, length
is actually a property not a function, so it shouldn't have ()
following it:
let number = answer.length;
3) Also, it looks like you're missing some backtick marks in that last alert();
dialog. It should have backticks inside the ()
since it's a string and you're using a template literal. Here's this line of code updated:
alert(`The string ${answer} is ${number} characters long.`);
Try making those changes, and then see if your code will run! :) Also, be sure to check your browser's console to see what's going on if you're experiencing any errors / things aren't working the way they should.
P.S. When posting code in forum, check out the Markdown Cheatsheet located right below the text area where you type your post/comment/answer. It can make it easier for others to easily review your code (and also help when you're answering questions for others)! ;)
![Rouillie Wilkerson](https://secure.gravatar.com/avatar/e992b67b411925bfa213793528dad2a2?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Rouillie Wilkerson
166 PointsBack tics? There was no mention of backticks in the tutorial...
kols
27,007 Pointskols
27,007 PointsI made a couple of errors in my response (Oops; sorry! Going too quickly ha). These have now been updated. ^^
Melissa Ferguson
8,274 PointsMelissa Ferguson
8,274 PointsI feel I should have saw those mistakes but Thanks so much!