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 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"