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

Why is my code wrong?

Yes i know ... this is way off lol . Whats the correct answer cause im i cant figure it out .

app.js
var id = "23188xtr";
var lastName = "Smith";
var pound = '#';
var userName = (id.toUpperCase());
id + pound + lastNAme;
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>

2 Answers

Hi Obe,

You're pretty close. Try dropping the pound variable and keep all of your code on the userName variable line. Then add the pound sign as a string and the lastName variable. You can add the lastName variable the same way you added the id variable in Step 1.

Cheers!

Kuanyshbek Ospanov
Kuanyshbek Ospanov
17,416 Points

Hello man, i think I'm too late, but there is an answer of your question

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