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

Rhonda Goolsby
Rhonda Goolsby
6,992 Points

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() + "."; 
Rhonda Goolsby
Rhonda Goolsby
6,992 Points

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

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

6 Answers

Rhonda Goolsby
Rhonda Goolsby
6,992 Points

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

Rhonda Goolsby
Rhonda Goolsby
6,992 Points

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.

Tai Jun Jie
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Tai Jun Jie
Full Stack JavaScript Techdegree Graduate 23,907 Points

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

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

This should suffice

Rhonda Goolsby
Rhonda Goolsby
6,992 Points

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