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

Javi Caballero
Javi Caballero
7,422 Points

Below role, create a new variable named msg that combines the firstName, lastName and role variables to create a string

I can't seem to figure out why this is wrong. Ik it is something, but I can't find it.

app.js
let firstName = 'Javi';
let lastName = 'Caballero';
let role = 'developer';
let msg = firstName + " Javier " + lastName + "Caballero: developer" + role;

1 Answer

Steven Parker
Steven Parker
231,248 Points

What this code currently puts into msg is: "Javi Javier CaballeroCaballero: developerdeveloper".

You will only need to use literal strings for spaces and/or punctuation. Your names and the role are filled in by the variables.

Javi Caballero
Javi Caballero
7,422 Points

Thanks! And wow, you answer a lot of questions lol... wait... BRO 215,000 POINTS THATS CRAZY

Steven Parker
Steven Parker
231,248 Points

About half of those points are from answering forum questions.   :wink: