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

Marlon Shaw
Marlon Shaw
2,329 Points

add '#' between id and lastName

var id = "23188xtr"; var lastName = "Smith";

var userName = id += '#' + lastName;

userName.toUpperCase(); alert(userName);

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

var userName = id += '#' + lastName;

userName.toUpperCase();
alert(userName);
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

Hi Marlon,

There are a few ways to go about this challenge. Your way was almost correct except for the = sign and that you didn't store the result of userName.toUpperCase() back into userName. Just calling userName.toUpperCase() doesn't really do anything by itself; userName isn't permanently converted into the upper case format unless you assign it the result of calling that method.

var id = "23188xtr";
var lastName = "Smith";

//removed = sign, only need + for concatenation
var userName = id + '#' + lastName;

//set userName equal to itself in upper case format
//results in 23188XTR#SMITH
userName = userName.toUpperCase();
Hugo Paz
Hugo Paz
15,622 Points

Hi Marlon,

You have an equals sign (=) here:

var userName = id += '#' + lastName;

Just remove it and youll be fine

Marlon Shaw
Marlon Shaw
2,329 Points

I have been doing that but error still says "you did not add "#" character between id and lastName"

var id = "23188xtr"; var lastName = "Smith";

var userName = id + '#' + lastName;

userName.toUpperCase(); alert(userName);

Marlon Shaw
Marlon Shaw
2,329 Points

Okay, this seemed to work.

var id = "23188xtr"; var lastName = "Smith";

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

alert(userName);