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 trialChristopher Flores
6,898 PointsJust not getting it...
Q: Finally, add a # symbol and lastName in uppercase to the end of the userName string. The final value of userName is "23188XTR#SMITH".
I'm typing all kinds of stuff, even 'id' + 'lastName'
23188xtr#Smith - without the # - #lastName - ETC.
JavaScript is finicky
var id = "23188xtr";
var lastName = "Smith";
var userName = (id.toUpperCase()) + '#lastName';
<!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
Ruben Ponce
Full Stack JavaScript Techdegree Student 12,035 PointsIt's trying to show you how to concatenate a string. So you join two strings together with the + operator. It wants you to have a pound sign between id and lastname. So essentially you have to 'add' all three of those values.
edit: Also, '#lastName' will be printed out as literally '#lastName'. You need to use the variable, lastName and the string of '#'.
Christopher Flores
6,898 PointsI'm not getting it
after (id.toUpperCase()) I'm writing:
- 'id' + '#' + 'lastName';
'id' + 'lastName';
'id' + '#' +'lastName';
I'm not getting it. Am I putting too many + or not enough spaces or too many spaces?
Ruben Ponce
Full Stack JavaScript Techdegree Student 12,035 PointsYou're writing strings instead of variables that hold strings. if var name = 'Christopher'
name === 'name'.//false
name === 'Christopher'//true
'name'==='name'//true
Christopher Flores
6,898 PointsIs it 'id' + '#' + 'lastName'
or
'id' + '#lastName' ???
Ruben Ponce
Full Stack JavaScript Techdegree Student 12,035 PointsItβs id + β#β + lastName with toUpperCase on the variables
Christopher Flores
6,898 PointsYeah, I actually just figured it out
I wrote:
- '#' + (lastName.toUpperCase)); and it worked
thanks Ruben