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

i created a variable myName but it keeps saying error.its telling me dont put anything in yet.any advise?

its telling me to not put anything in it but not sure what it means by that.

scripts.js
var = "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

You have to declare a variable name first and then put something in it. In this case it's asking not to put anything into the variable yet. The syntax should read something like this: var myName = " ";

I’m sure you already know this, but the equal sign doesn’t mean the same thing as it does in mathematics (this equals that), it’s actually used to assign things.

So if you have var = “myName”

It’s like creating a variable with no label and assigning a string of myName.

You want the name on one side of the equal sign and the value on the other

In this case it’s myName = blank

To create a blank entry just use empty quotes “ “

Var myName = “ “