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 trialsaisindhoorreddy palla
1,146 Pointsi got following problem
i need the code and what is thee problem plz?
var id = "23188xtr";
var lastName = "Smith";
var userName= id.toUpperCase();
var userName= userName+'#'+LastName.toUpperCase();
alert(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>
2 Answers
Juan Luna Ramirez
9,038 PointsJavascript is case sensitive. You have LastName
when it should be lastName
.
This is a ReferenceError since LastName
with capital L does not exist.
Christopher Debove
Courses Plus Student 18,373 PointsGustavo Winter please don't introduce false informations.
Variables can start with uppercase letter, the problem is that his variable was named "lastName" and variable names are case sensitive.
Gustavo Winter
Courses Plus Student 27,382 PointsChristopher Debove Sorry, i dont want to introduce false informations. But until know variables cant start with uppercase letter. The same for start with numbers.
but, if its possible, thank you for correct me and sorry for the false information.
Christopher Debove
Courses Plus Student 18,373 PointsTo be more precise, variables name are written in lower camel case by convention. But starting a variable name with an uppercase character is valid.
Those are all valid in JS :
myVariable1
MyVariable1
$myVariable1
_myVariable1
Those are not valid :
%myVariable
my%Variable
1myVariable
Gustavo Winter
Courses Plus Student 27,382 PointsGustavo Winter
Courses Plus Student 27,382 Pointscheck this line:
var userName= userName+'#'+LastName.toUpperCase();
Var cant start with capitalized letters