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