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

Am I not doing it correctly?

Can anyone point out where i have gone wrong? i need to add the var = id (in uppercase) a # and then var =lastName (uppercase) altogether

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

var userName = id.toUpperCase();
var userName = "#" + "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>

1 Answer

You have the right idea but you're overriding the value of the variable. What you're looking for is:

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

If you were to console.log(userName); the way you did, it would only print #SMITH

Thank you Chris you are very kind for helping me! I am struggling to correctly use ; " ect..... i need more time to practice the syntax i guess. I see you have 25000 points on Tree house, do you mind me asking how long you have been using treehouse? hope you have a great day :)