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 trialjeremychris
Courses Plus Student 1,599 Pointshow do i name a variable
tried to write the named varable as var name = "noName";
just not sure what Im missing. Its been about a month since i could finally get back on. Probably just start over and go from there
var name = "myName";
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaScript Basics</title>
</head>
<body>
<script src="scripts.js"></script>
</body>
</html>
3 Answers
Adam Beer
11,314 PointsChallenge Task 1 of 2
Create a variable named myName but don't put anything in it yet.
You wrote name to variable name, not myName, but don't put anything in it yet. So the myName variable value is nothing.
jeremychris
Courses Plus Student 1,599 Pointsvar myName ="";
honestly after looking at both of your answers i did a homer "doh" thanks.!
Adam Beer
11,314 PointsYou have not given anything now, but var myName expect a string value. So now you did not put value. Later it can be a string, boolean or number, like this
var myName;
Mike Hatch
14,940 PointsThe instructions say to:
"Create a variable named sayName but don't put anything in it yet."
I'm halfing that one line of instruction line into two parts:
-
Create a variable named
sayName
- But don't put anything in it yet.
So basically you are declaring a variable without yet assigning it a value.