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

hala great
hala great
629 Points

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

Hello, can I get any help with this task ?

app.js
var id = "23188xtr";
var lastName = "Smith";
console.log(id.toUpperCase());
var userName= id + "Smith"
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>
Dave StSomeWhere
Dave StSomeWhere
19,870 Points

Sure can, what is your question?

2 Answers

Andrey Misikhin
Andrey Misikhin
16,529 Points

You didn't assign your uppercased id to variable before send it to console. Try this: var userName = id.toUpperCase() + "Smith"; console.log(userName );

You're on the right track, but there are a couple of things that need fixing. Let's take a look at what you have so far.

var id = "23188xtr";
var lastName = "Smith";
console.log(id.toUpperCase());
var userName= id + "Smith"

So when you start the challenge. First remember that these challenges are just like any other program, so if you take an extra step it will make your answer as wrong. Here you console.log the answer, where the question asks you to add it to the variable userName, not to console.log it. Secondly, for userName you have id + "Smith". An idea, why use the variable id and then not use the variable lastName? remember lastName = "Smith", so if I wrote id + lastName that would give me 23188xtrSmith. If you have data in a variable use the variable not the data.