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

hey please help me with that, confused

Hey I got confused. thank you

app.js
var id = "23188xtr";
console.log("id.toUpperCase");
var lastName = "Smith";

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

Hey!

Okay, so first things first - .toUpperCase always comes with () at the end. Without the brackets at the end, the method will not work.

Now, let's break down the requirements of the challenge.

"Challenge Task 1 of 2 - Use the JavaScript .toUpperCase( ) string method to assign an all uppercase version of the id variable to the userName variable." --- The challenge wants you to turn variable "id" to an all uppercase (so you use id.toUppercase() as you did, except you don't log it to the console, that was not a requirement), and it wants you to store that in the "userName" variable. You store things in a variable like this: VARIABLE = THING YOU WANT TO STORE . Specifically for the task, it should go like this:

var userName = id.toUpperCase();

Following the above example, in the second step of the challenge you now have to add more stuff into the "userName" variable. It wants you to add a "#" symbol and an uppercase version of the "lastName" variable. I think this hint will help you, but let me know if you need more assistance.

Good luck!

Hey!

You only write "var" once, when you are declaring the variable. After that, when you want to add stuff to it, you only write the name of the variable.

In addition, # is a symbol. You can't .toUpperCase() it, like a letter, since it doesn't have a capital version.

So to pass the challenge you'll either do it like this:

 userName += "#" + lastName.toUpperCase();

or just add it to the existing line of code, like this:

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

thank you for your respond. i could not find any right answer for the second one. var userName += #.toUpperCase(); var userName += lastName.toUpperCase();

I appreciate your assist. Regards