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 Working with Strings Combine and Manipulate Strings

Assign your first name to variable firstName and your last name to variable lastName

I don't know how to do it

app.js
Let firstName = prompt("What is your fisrt name?");
Const lastName = prompt("What is your Last name?");
firstName += lastName;

3 Answers

Steven Parker
Steven Parker
230,230 Points

You won't need to use prompt in this challenge. Just encode your names as literal strings.

You also won't modify the initial values after assignment. In a later step, you will create a new variable to combine them.

Rick Gleitz
Rick Gleitz
47,522 Points

Also, let and const begin with lower case letters. No need to mix them. They can both be let.

thanks

Sara Pena
Sara Pena
5,663 Points

Assign your name to the variables just means to add your name to each variable as 'strings'.

Also, if you intend to eventually change or update the values of your variables, choose 'let'. Otherwise, keep 'const'.

As you might have learned earlier in the course, 'var' is no longer used due to scoping reasons. Meaning, it can be seen inside or outside code blocks and could potentially harm your code by changing values of your 'var' unintentionally.

Let example:
let x = 1;
let z = 2;
x + z = 3;
x = 2;
x+ z = 5;

Const example: const x = 2; const z = 5; x = 10; // this will return as undefined x + z = 7;

Assign a number to variable x,

x =