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 Combining Strings

Katrina Italiano
Katrina Italiano
721 Points

Error "It looks like you put quotes around the variable names firstName and lastName"

I'm not sure where I'm going wrong here. The first 2 tasks prompted me to use the quotes when sending the variables back to themselves, so I'm confused.

script.js
var firstName = prompt("What is your first name?");
var firstName = "firstName";
var lastName = prompt("What is your last name?");
var lastName = "lastName";
var fullName = (firstName + lastName);
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="script.js"></script>
</body>
</html>

1 Answer

Shay Paustovsky
Shay Paustovsky
969 Points

Hi Katrina,

Firstly you're doing an awesome job, keep up the good work. Secondly you wer'e on the right way.

Let me explain myself :

You are not asked to store the input from the 'prompt' method into a variable called 'firstName' or 'lastName'. They simply ask to create 2 new variables named: 'firstName' & 'lastName' and store your name (respectively) in each and then concatenate them.

var firstName = "firstName";
var lastName = "lastName";
var fullName = firstName + " " + lastName //That is if you want a space between the names.

Hope I've helped.

Happy Coding

Shay