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

Gonzalo Torres del Fierro
PLUS
Gonzalo Torres del Fierro
Courses Plus Student 16,751 Points

wrongg??

var id = "23188xtr"; var lastName = "Smith"; var hash ="#" id+=hash; lastName=id+=lastName;

var userName = console.log(lastName.toUpperCase());

app.js
var id = "23188xtr";
var lastName = "Smith";
var hash ="#"
id+=hash;
lastName=id+=lastName;

var userName = console.log(lastName.toUpperCase());
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

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

var userName = id.toUpperCase();
userName += "#" + lastName.toUpperCase();
Mike Hatch
Mike Hatch
14,940 Points

You can complete this task in four lines of code. Your first two lines of code are correct, so now you just need the last two lines to be corrected. Continue the code that the Challenge left you.

Lines 3 and 4:

var userName = id. // Partial code
userName += lastName. // Partial code

No need for the console.log or hash variable. I gave you partial code for lines 3 and 4

Gonzalo Torres del Fierro
Gonzalo Torres del Fierro
Courses Plus Student 16,751 Points

ok I agreed, no need, but I mean, the result it is the same if they ask me for the best solution or the simplest one, it is my duty to do it, but the same behavior with my code according to with the Google browser (J.S debugging) deserve to put some attention with the degree of acceptance of the challenge code requested. just sharing my point of view. :) but I have to say thank you for your answer.