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

Assign an all uppercase version of the id to the userName Variable

Having a little trouble here can anyone help me out #stuck

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

Hugo Paz
Hugo Paz
15,622 Points

Hi Timothy,

The challenge asks you to assign an all uppercase id to userName.

So you need to use the toUpperCase() method on the variable id.

Like so:

var userName = id.toUpperCase();
Arturo Espinoza
Arturo Espinoza
9,181 Points

I don't think the wording on this one is right. It confused me so much. I see your answers but I still don't understand what its asking. I kinda knew what it was asking so I took an educated guess with var userName = id.toUpperCase(); and it was correct.

Dave McFarland
STAFF
Dave McFarland
Treehouse Teacher

Hi Timothy McKyer

The problem is in this line:

var userName = 'id.toUppercase() + userName.toUppercase() ' ;

You shouldn't put quote marks around id.toUppercase() + userName.toUppercase()

Also you don't need to re-declare the variable -- var userName -- in the last line.

Thanks for the help, but i just retyped the code without the quote marks and i didn't re-declare the var userName line and it still did not work.

Dave McFarland
Dave McFarland
Treehouse Teacher

Sorry. Didn't read this closely enough: Hugo Paz has the answer!