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

combine strings

what's wrong here? i can t figure out, please help me

app.js
let firstName = "Carlos";
let lastName = "Salgado";
let role = "developer";
let msg = firstName + lastName + role;

2 Answers

Juan Luna Ramirez
Juan Luna Ramirez
9,038 Points

Can't see the challenge but maybe they are testing for a string with spaces. So maybe they are loking for the msg variable to be "Carlos Salgado developer" and you currently have "CarlosSalgadodeveloper"

You can use interpolation or just add the spaces like so:

let msg = firstName + ' ' + lastName + ' ' + developer

None of the answers that I have tried has given me the correct answer. On line 4 let msg = ('firstName' + ' ' + 'lastName' + ':' 'role');

The response to my code says "Bummer. Cannot read property 'I' of null

Please help me. This is not allowing me to move on to the next question. Do I have my punctuation right? Any more advice is greatly appreciated.

an't see the challenge but maybe they are testing for a string with spaces. So maybe they are loking for the msg variable to be "Carlos Salgado developer" and you currently have "CarlosSalgadodeveloper"

You can use interpolation or just add the spaces like so:

let msg = firstName + ' ' + lastName + ' ' + developer

Juan Luna Ramirez
Juan Luna Ramirez
9,038 Points

Julian, it seems this question is not very clear for a lot of people. I believe the role has to be in all caps from what I've seen in other answers to this question.

So you can answer by concatenating like this:

let msg = firstName + " " lastName + ": " + role.toUpperCase();

or using interpolation with template literal like this:

let msg = `${firstName} ${lastName}: ${role.toUpperCase()}`;