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

Why isn't this string producing id#lastName? See details below please.

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

var userName =id.toUpperCase(id) +'#' +lastName.toUpperCase(lastName);

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

var userName =id.toUpperCase(id) +'#' +lastName.toUpperCase(lastName);
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

vinona weil
seal-mask
.a{fill-rule:evenodd;}techdegree
vinona weil
Front End Web Development Techdegree Student 1,224 Points

dont add anything in parentheses leave them blank also add space after + and the correct answer is below

 var userName = id.toUpperCase()+ "#" + lastName.toUpperCase();
Viktor Doska
Viktor Doska
2,138 Points

Hello, Shane, I think the problem is that you have an error in this line:

var lastName = "Smith");

There's a parenthesis and its making your program crash Try removing it so the line looks like

var lastName = "Smith";

Next time you cant make something work open browser console (In Chrome its CTRL + SHIFT + J), there you will see all the info about your program and errors! Also when using

toUpperCase()

method you can just leave parenthesis empty, so this lines give the same result

var test1;
var test2;
var name = 'Viktor';

//This will return Viktor
test1 = name.toUpperCase();

//This will return the same result so test1 == test2
test2 = name.toUpperCase(name);

Good luck!