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 trialHaleema Mehmood
Courses Plus Student 189 PointsAssign your first name to variable firstName and your last name to variable lastName
I don't know how to do it
Let firstName = prompt("What is your fisrt name?");
Const lastName = prompt("What is your Last name?");
firstName += lastName;
3 Answers
Steven Parker
231,248 PointsYou 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
47,876 PointsAlso, let and const begin with lower case letters. No need to mix them. They can both be let.
Haleema Mehmood
Courses Plus Student 189 Pointsthanks
Sara Pena
5,663 PointsAssign 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 =