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 trialBeth Osburn
Courses Plus Student 344 Pointshow to Use the JavaScript .toUpperCase( ) string method to assign ?
Use the JavaScript .toUpperCase( ) string method to assign an all uppercase version of the id variable to the userName variable.
var id = "23188xtr"; var lastName = "Smith"; var id = lastName.toUpperCase(); var userName
var id = "23188xtr";
var lastName = "Smith";
var id = lastName.toUpperCase();
var userName
<!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>
1 Answer
Jason Anders
Treehouse Moderator 145,860 PointsHi Beth,
You are using the method correctly. You are just using it on the wrong variable. Right now, you are re-assigning a value to the id
variable (you are removing the value that was there and are replacing it with an upper-cased version of the lastName
variable. When the instruction say to
assign an all uppercase version of the id variable to the userName variable.
Here, the challenge has provided the new variable userName
for you to use.
So, you need to delete the line of code you added, and just assign the upper-cased version of id
(not lastName) to the userName
variable (not id).
Hope this helps clear things up. :)
Keep Coding!
Beth Osburn
Courses Plus Student 344 PointsBeth Osburn
Courses Plus Student 344 PointsModerator added Markdown so the code is readable
is this close?
Jason Anders
Treehouse Moderator 145,860 PointsJason Anders
Treehouse Moderator 145,860 PointsNot really. You're still not using the correct variable that was provided.
You're first one was correct in syntax, just not using the right variables. (And the challenge doesn't say to include a console.log method).
Because you did have the correct syntax above, I will include the corrected code for you now. Have a look at what you had originally, the answer I provided above, and the corrected code below. Hopefully you will see where I was going with my first response and that it'll make more sense now.
Also, when posting code (copy / paste) style, please refer to the Markdown CheatSheet for formatting rules, otherwise the code is pretty unreadable in the Community posts. I have corrected you comment to include Markdown formatting.
Hope this all helps now.