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

Joseph Hookham
Joseph Hookham
2,493 Points

Task 3 / 3 - Can't convert role to uppercase.

Hi, I've tried lots of variations but it won't recognise 'role' as a variable and the modifier won't act on it. Thanks.

app.js
let firstName = "Joe";
let lastName = "Hookham";
let role = 'developer';
let msg = firstName + ' ' + lastName + ': ' + role;
var upper = role.toUpperCase;

hey joseph u are dping right but only mistake u had done right but after.toUpperCase() add circular brackets to define that it is a method

Rick Gleitz
Rick Gleitz
47,876 Points

Bihari, your answer won't quite work all by itself. In addition, you would need to place the 'var upper' line above the 'let msg' line and change '+ role' at the end of 'let msg' to '+ upper'

3 Answers

Rick Gleitz
Rick Gleitz
47,876 Points

Get rid of the let upper line and change the end of the let msg line to read: + role.toUpperCase();

Rick Gleitz
Rick Gleitz
47,876 Points

You don't need a new variable, just put .toUpperCase() onto the end of role in your msg variable. Hope this helps!

Joseph Hookham
Joseph Hookham
2,493 Points

Thanks for the replies. I still can't get it to work.

I've tried it like this:

let firstName = "Joe"; let lastName = "Hookham"; let role = 'developer'; let role.toUpperCase(); let msg = firstName + ' ' + lastName + ': ' + role;

And

let firstName = "Joe"; let lastName = "Hookham"; let role.toUpperCase() = 'developer'; let msg = firstName + ' ' + lastName + ': ' + role;

And

let firstName = "Joe"; let lastName = "Hookham"; let role = 'developer'; let upper = role.toUpperCase(); let msg = firstName + ' ' + lastName + ': ' + role;

Joseph Hookham
Joseph Hookham
2,493 Points

Oh that didn't format how I imagined... hope it still makes sense.