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 trialAlexandru Pescaru
6,410 Pointscan anyone help me with this task. thx
let firstName = ' Carlos';
let lastName = 'Salgado ';
let role = 'developer';
const msg = firstName + name + lastName + name + role ;
4 Answers
Steven Parker
231,269 PointsIt looks like you have a few issues:
- nothing called "name" has been defined
- there should not be an empty space at the beginning or end of your
firstName
orlastName
string value - make sure you're adding one space (" ") between
firstName
andlastName
- make sure you're concatenating ": " to
lastName
androle
let firstName = 'Carlos';
let lastName = 'Salgado';
let role = 'developer';
const msg = firstName + " " + lastName + ": " + role;
Alexandru Pescaru
6,410 Pointslet firstName = 'Carlos'; let lastName = 'Salgado'; let role = 'developer'; const msg = firstName + "Carlos " + lastName "Salgado" + ": " + role + "developer" + (".");
what am i doing wrong ?
Steven Parker
231,269 PointsCompare the last line to the example in my answer.
Alexandru Pescaru
6,410 PointsDone! It's showing sthis msg: Cannot read property '1' of null
Steven Parker
231,269 PointsThe example in my answer passes task 2. You must still have something different.
Alexandru Pescaru
6,410 Pointslet firstName = 'Carlos'; let lastName = 'Salgado'; let role = 'developer'; const msg = firstName + "Carlos " + lastName "Salgado: " + role;
Steven Parker
231,269 PointsYour code is still different, comparing to the example code in my answer should make the problem clear.
Alexandru Pescaru
6,410 Pointslet firstName = 'Carlos'; let lastName = 'Salgado'; let role = 'developer'; const msg = firstName + "Carlos" + lastName + "Salgado: " + role;
Make sure you're adding one space (' ') between firstName
and lastName
.
am i missing the space ? "Carlos " like tihis ?
Alexandru Pescaru
6,410 PointsOK! thx vreu much!
Zimri Leijen
11,835 PointsZimri Leijen
11,835 Pointswhy do you have the name there twice?
name isn't even a variable