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 trialMichael Doria
647 PointsAdding a "#" symbol to a string with .toUpperCase
I don't know where to add the # symbol to the final userName string.
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase();
var userName;
<!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>
1 Answer
Jose Gallardo
1,662 PointsHello, you can use the '+' operator to concatenate strings like this
var firstName = "John";
var lastName = "Doe";
var fullName = firstName + "#" + lastName ;
therefore you get stored in the fullName variable 'John#Doe'.
Also you can use the toUpperCase() method in the concatenation
var fullName = firstName.toUpperCase() + "#" + lastName.toUpperCase() ;
console.log(fullName);
then the output is ''JOHN#DOE'.
I hope that you can figure out your exercise now
Michael Doria
647 PointsMichael Doria
647 PointsHaving trouble adding the id var to the lastName var with the # symbol to make 23188XTR#SMITH as my userName var