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

Jordan Hancock
Jordan Hancock
1,385 Points

Can someone help me with part one of this challenge?

I'm just having trouble understanding how to move forward. I've tried a few things but I need some help. I would really appreciate it if someone could explain to me how to do this challenge. Thanks!!!

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

Hey Jordan, the correct Syntax is as follows below. You use reference or call the variable name id, then you use put the method which is .toUpperCase() followed by a semicolon. This means your taking the value in variable id which is a string '23188xtr' and running a method that converts it to upper case, then assigned to the left in the variable userName.

var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase();
Andrey Misikhin
Andrey Misikhin
16,529 Points
var id = "23188xtr";
var lastName = "Smith";

var userName = id.toUpperCase( );
Andrey Misikhin
Andrey Misikhin
16,529 Points

Because .toUpperCase() is the standart js method for string variable, and this variable was been created on the first row. So we must call method from this variable. 'id'.toUpperCase() result is 'ID', because 'id' is a new string variable for js.