Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Basics (Retired) Storing and Tracking Information with Variables Create a Variable

alonzo alvarado
alonzo alvarado
3,387 Points

create a variable named "myName" but don't put anything in it yet.

i dont understand what its refering to by "dont put anything in it yet" this was my code:

var message = "myName";

it says i didnt name the variable "myName"

scripts.js
var message = "myName"
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="scripts.js"></script>
</body>
</html>

2 Answers

Damien Watson
Damien Watson
27,419 Points

So create a variable called "myName" with nothing in it would be:

var myName = "";
alonzo alvarado
alonzo alvarado
3,387 Points

OOOOOOOHHHHH!!! so the name of the variable goes before the "="?! thank you so much damien :D

Jonathan Romine
Jonathan Romine
9,344 Points

Try this:

var myName = "Your Name";

alonzo alvarado
alonzo alvarado
3,387 Points

it worked thank you :D the syntax of javascript is still a little confusing to me... so its

var name of var = "whatever this is called"