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

johnny louifils
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
johnny louifils
Full Stack JavaScript Techdegree Graduate 18,926 Points

Am I getting this right?

It keeps saying syntax error

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

4 Answers

Hey, First there is a small spelling mistake in that it should be id.toUpperCase() rather than id.toUpperCase).

I believe HIDAYATULLAH is incorrect, id is still considered a string even if it has numbers in it. What you wrote should work.

Mike Hatch
Mike Hatch
14,940 Points

The code as you currently have it will produce the following error in Google Console: Uncaught SyntaxError: Unexpected token )

That's because you're not calling the method with correct syntax in your code. There should be two parentheses. Did you make a typo or was that a syntax error? If it was just a typo, console logging it will only print out the function. It will not invoke the .toUpperCase method.

Your syntax error is that you are missing ( in toUpperCase(). The challenge asks you to assign this to userName.

HIDAYATULLAH ARGHANDABI
HIDAYATULLAH ARGHANDABI
21,058 Points

It has only a spelling mistake it should work properly.