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 trialhala great
629 PointsUse the JavaScript .toUpperCase( ) string method to assign an all uppercase version of the id variable to the userName v
Hello, can I get any help with this task ?
var id = "23188xtr";
var lastName = "Smith";
console.log(id.toUpperCase());
var userName= id + "Smith"
<!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
Andrey Misikhin
16,529 PointsYou didn't assign your uppercased id to variable before send it to console. Try this: var userName = id.toUpperCase() + "Smith"; console.log(userName );
Jacob Mishkin
23,118 PointsYou're on the right track, but there are a couple of things that need fixing. Let's take a look at what you have so far.
var id = "23188xtr";
var lastName = "Smith";
console.log(id.toUpperCase());
var userName= id + "Smith"
So when you start the challenge. First remember that these challenges are just like any other program, so if you take an extra step it will make your answer as wrong. Here you console.log the answer, where the question asks you to add it to the variable userName, not to console.log it. Secondly, for userName you have id + "Smith". An idea, why use the variable id and then not use the variable lastName? remember lastName = "Smith", so if I wrote id + lastName that would give me 23188xtrSmith. If you have data in a variable use the variable not the data.
Dave StSomeWhere
19,870 PointsDave StSomeWhere
19,870 PointsSure can, what is your question?