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

Why doesn't this work? const msg = firstName + " " lastName + ":" role.toUpperCase() + ".";

I do not know why this is not working. Any ideas out there?

app.js
let firstName = 'Rhonda';
let lastName = 'Goolsby';
let role = 'developer';
const msg = firstName + " " + lastName + ":" +  role.toUpperCase() + "."; 

I console.log the output and it returns: Rhonda Goolsby: DEVELOPER

I want to keep moving through the course. Please help.

6 Answers

Thanks Jun Jie Tai, that was it! Great attention to detail:)

May I know what is the output that you are expecting? I've tried your code and the output I got was Rhonda Goolsby:DEVELOPER.

Rhonda Goolsby:DEVELOPER is the expected outcome, but the javaScript basics test question says it is not correct and that I need to add .toUpperCase.

You do not need to include the last "." at the end of your code

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

This should suffice

And also make sure there is a space after the colon. Happy coding.

Thank you Jun JIe Tai, I will give that a try and let you know what happens.

Alright no problem.