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 trialPeter Mercado
8,066 PointsLost
var id = "23188xtr"; var lastName = "Smith";
var userName = userName + id; userName.toUpperCase();
I tried this. It must be wayyy out of order.
var id = "23188xtr";
var lastName = "Smith";
var userName = userName + id;
userName.toUpperCase();
<!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
Joseph Wasden
20,406 PointsSo, in your code below, what you are accomplishing is to add (or concatenate) the contents of the userName and id variables and then set that value to be the value of user name. then, you are upper uppercasing this concatenated value.
var id = "23188xtr";
var lastName = "Smith";
var userName = userName + id; //<-- here is where you are concatenating, or added the two variable contents together, under one name, in this case, userName
userName.toUpperCase();
You are doing more than is needed. Lets just set the variable username to have the contents of the id variable, and set the id variable contents to upper case.
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase(); //here we assign the userName variable to be the upper case contents of the id variable
Peter Mercado
8,066 PointsThank you !
Joseph Wasden
20,406 PointsYep. :)
Good luck!