JavaScript JavaScript Basics Working with Strings Combine and Manipulate Strings

Juan Pablo Castrillon
Juan Pablo Castrillon
789 Points

Bummer: Make sure you're adding one space (' ') between `firstName` and `lastName`.

let firstName = 'JP';
let lastName = 'Castrillon';
let role = 'developer';
let msg = `firstName`  +  `lastName` + `role`;

2 Answers

Stefan Caky
Stefan Caky
Full Stack JavaScript Techdegree Student 8,227 Points

Hi. When you adding space like this: let msg = 'firstName' + 'lastName' + 'role'; Is wrong because no space inside of string like this 'firstName '. Also you using a Template Literal symbol. So the good answer will be:

let msg = 'firstName ' + 'lastName ' + 'role'; :)

Brett Steger
Brett Steger
1,371 Points

Hello! I'm new to coding and definitely feel out of place answering a question but I'm pretty sure I know the answer.

you have to add a space somewhere after 'firstName' before 'lastName' and another between 'lastName' and 'role' (ex: 'firstName' + ' ' + 'lastName' + ' ' + 'role') I believe you can also write it as: 'firstName ' + lastName ' + 'role'

this way when you display the entire 'msg' you will have spaces and be able to read it properly. pretty sure you are near the template literals course, that is another way to write it, I prefer it.