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

Levente Bito
Levente Bito
4,679 Points

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

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

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

am struck in the same spot

5 Answers

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

var userName = id.toUpperCase();

This should work. :) Don't worry about to make lastName into uppercase.

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi Levente! You're so close here that I'm just going to give some hints. You are doing the id.toUpperCase() part correctly. However, you are writing it to the document, which wasn't asked for by the challenge. The challenge asks for that part to be the value assigned to the variable userName.

I think you can get it from just these hints, but let me know if you're still stuck! :sparkles:

I am also stuck. Here's what I have:

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

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

It won't allow this for some reason. I realize I might be doing more than what is asked, but the error messages suggest otherwise.

<p>I'm stuck at this for two days makes me hungry</p> '''hmtl var id = "23188xtr"; var lastName = 'Smith";

var userName (id.toUpeercase()); '''

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

var userName = (id.toUpperCase());

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

var userName = (id.toUpperCase());

This should help.

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

var userName=(id.toUpperCase()); console.log(userName); console.log(userName.toUpperCase());