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

Use the JavaScript .toUpperCase( ) string method to assign an all uppercase version of the id variable to the userName v

Hi! I am working on this code and I am having trouble understanding what it is I am going to fix. I don´t understand the question. Please help.

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

var userName = 'id'+'lastName'): console.log('id'.toUpperCase());

<!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>

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

var userName = 'id'+'lastName'):
console.log('id'.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>

3 Answers

Louise,

Remember, the instruction is to 'use the .toUpperCase( ) string method to assign an all uppercase version of the id variable to the userName variable'.

When I read that, I see two steps:

  1. Use the string method to make id uppercase, and
  2. Assign that uppercased variable to userName. (Hint: you've done this in the console.log statement, but you don't need to use console log--because you're not being asked to output anything.)

For step 1 of the Challenge, you can do both steps in one line of code.

For step 2 of the Challenge, you add (concatenate with the '+' symbol) the "#" and lastName variable to the end of that line of code.

Hi! Okey thank you for quick reply! I will try do as you wrote and se if I understand better.

Steven Parker
Steven Parker
231,275 Points

Here's a few hints:

  • you won't need "console.log" in this challenge
  • only what you assign to "userName" will be checked
  • there's a stray closing parenthesis on the line where "userName" is assigned