Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Basics Working with Strings Combine and Manipulate Strings

Frank Grillo
Frank Grillo
5,223 Points

Convert Last Word to Capital Letters

How do I convert the last word in the string to Capital Letters?

app.js
let firstName = 'Frank';
let lastName = 'Grillo';
let role = 'developer';

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

let word = 'developer';

let shout = developer.toUpperCase();

1 Answer

Mark Sebeck
MOD
Mark Sebeck
Treehouse Moderator 32,410 Points

Hi Frank. Couple of issues here. First delete word and shout. Those are not needed. Your format for changing to uppercase on shout is correct. Move that to role on the msg variable.

Now you also have to be careful and build the msg string exactly like they ask. So you need a space after the :. So it should be like + ‘: ‘. And then also get rid of the period at the end. They didn’t ask for that. Hope this helps Frank and post back to the community if you are still stuck.