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

Andre Chavira
seal-mask
.a{fill-rule:evenodd;}techdegree
Andre Chavira
Front End Web Development Techdegree Student 4,556 Points

I don't understand how to add a # in-between an id var and this lastName var it tells me toUpperCase, please help!

I got stuck trying to figure out what its asking me to do and how i should place the # sign in the middle of the id var and the lastName var that im suppose to make uppercase. I get how to use the .toUpperCase(); part but i dont understand the instructions. I cant afford to get stuck rn somebody please help. :(

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>

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! First off, you're doing fine and this seems to be a common question with this particular challenge. It might be worth noting that there's nothing inherently special about the "#" symbol here. This can be done with simple concatenation. I'm going to show an example, and I think you can get it from there:

var firstName = "Jennifer";
var lastName = "Nordell";
var userName = firstName + "#" + lastName;

Given the example above, the value stored in userName would be "Jennifer#Nordell". Hope this helps, but let me know if you're still stuck! :sparkles:

Andre Chavira
seal-mask
.a{fill-rule:evenodd;}techdegree
Andre Chavira
Front End Web Development Techdegree Student 4,556 Points

thank you so much! i had a real hard time understanding the instructions and ended up complicating it with assumptions and extra stuff which made it confusing.