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

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 37,341 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.

Thank you so much!