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

Challenge Task 1 Issues. I cannot get past this task. The alerts showed but I am still experiencing an error.

Need help with string challenge. Challenge Task 1 Issues. I cannot get past this task. The alerts showed but I am still experiencing an error.

app.js
var id = "23188xtr";
var lastName = "Smith";
var stringToShout = prompt("What should I shout?");
var shout = stringToShout.toUpperCase();
shout += "!!!";
alert(shout);
var userName = stringToShout.toUpperCase('id');
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

Kyle Johnson
Kyle Johnson
33,528 Points

Hi Diane! It looks like the code challenge starts with this code provided:

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

var userName

It's asking you to set the userName = to an upper case version of the provided id variable. You can do this like this:

var userName = id.toUpperCase()

The second part of the challenge is asking to add the # symbol, followed by an upper case version of the lastName variable. You can use the + to add these strings and variable together like this:

var userName = id.toUpperCase() + "#" + lastName.toUpperCase()

Thank you.