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 JavaScript Basics (Retired) Storing and Tracking Information with Variables Using String Methods

Walter Garcia
Walter Garcia
4,531 Points

Can't concatenate "#" symbol between two strings, any help? thanks!

Can't concatenate "#" symbol between two strings, any help? when I put it all code gets grey color and a red saw underline appears, don't know why, thanks.

app.js
var id = "23188xtr";
var lastName = "Smith";

var userName= id.toUpperCase (); + "#" + lastName.toUpperCase (); 
index.html
<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
</head>
<body>
<script src="app.js"></script>
</body>
</html>

3 Answers

Caleb Kleveter
MOD
Caleb Kleveter
Treehouse Moderator 37,862 Points

Walter, I think the reason you are having the issue is because the semicolons in the user name variable (leave the one at the end) and the spaces between toUpperCase and the ().

   var userName= id.toUpperCase() + "#" + lastName.toUpperCase(); 

Let me know if it works!

Hi Walter,

You need to remove the semicolon after the first set of parenthesis in the app.js file. Also, I recall that the variable userName was already declared for you at the start of the exercise. If that is true, do not precede userName with the var keyword.

You can accomplish the concatenation like so:

id.toUpperCase(); lastName.toUpperCase(); userName += id + '#' + lastName;

Alternatively, you could do it all in one statement:

userName += id.toUpperCase() + '#' + lastName.toUpperCase();

Caleb Kleveter
Caleb Kleveter
Treehouse Moderator 37,862 Points

Zack Richard , I thought I might let you know I changed your comment to an answer. This allows you to be up-voted, and awarded with best answer!

Walter Garcia
Walter Garcia
4,531 Points

Hey Celeb, thank you very much! The bug was the semicolon after the first set of parenthesis, thanks.

Walter Garcia
Walter Garcia
4,531 Points

Hey Zack, thank you very much! The bug was the semicolon after the first set of parenthesis, thanks.

Walter Garcia
Walter Garcia
4,531 Points

Hey Celeb, thank you very much! The bug was the semicolon after the first set of parenthesis, thanks.