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

Ali Sh
Ali Sh
2,026 Points

HELP ME WITH THE ANSWER!!!

What is the function is used to apply the toUpperCase method? when to use the app.js and when to use index.html?

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

var userName = id;
console.log(userName.toUpperCae());
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

toUpperCase()

You have missed out the 's' in Case. You also need to assign the uppercase version to userName. At the moment, you are storing the normal id and then logging an uppercase version. Convert to uppercase and store it in username.

Timothy Harrington Bourne
Timothy Harrington Bourne
6,372 Points

var id = "23188xtr";

var lastName = "#Smith";

var userName = id + lastName

document.write(userName.toUpperCase())

This is the final answer: First you convert the id to uppercase and store it in userName (That's the first part of the problem). Then you add the '#' to the userName and the lastname converted to upper case.

var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase();
userName = userName + '#' + lastName.toUpperCase();

You were changing the lastName (not allowed) and not storing the uppercase versions in userName (not what was asked). They don't want to to log the result or display it to the document, just store it.