Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Basics (Retired) Storing and Tracking Information with Variables Using String Methods

I dont understand what I'm doing wrong.

I've tried with the console log but no matter what I code, it's wrong. I am a little lost as to what it's asking me exactly.

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

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

2 Answers

Halvard Bastiansen
seal-mask
.a{fill-rule:evenodd;}techdegree
Halvard Bastiansen
Data Analysis Techdegree Student 14,886 Points

You are very close. Just remove the " " around both id.toUpperCase().

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

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

Adam Beer
Adam Beer
11,314 Points

You are near. First, inside the userName, delete the apostrophes and the closing bracket. Second, rewrite your whole code into the userName. Third, don't use console.log() method, unnecessary, did not ask from you the challenge. Like this, the first task solution,

var userName= id.toUpperCase();

When you use numbers, boolean values or methods, you can't use apostrophes, you can use only for strings and symbols. Please check Strings and values in JavaScript.

Hope this help.

Adam Beer
Adam Beer
11,314 Points

//Output

var userName= 'id.toUpperCase()');
                                                        ^
SyntaxError: Unexpected token )

If you delete the closing bracket, the output is,

userName.toUpperCase()

You have been converted the console.log() content to string.

If you delete the apostophes,

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

the output is,

23188XTR

I think you should start using the Visual Studio Code. This is a code editor. The beginning is difficult to use, if you understand the editor it will help a lot.