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

nassim berkoun
nassim berkoun
1,708 Points

I do not understand how to uppercase strings

app.js
let firstName = "NB";
let lastName = "berk";
let role = 'developer';
const role = word.toUpperCase('role');
const msg = firstName + " " + lastName + ':' + role + ".";

1 Answer

Doris Keller
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Doris Keller
Front End Web Development Techdegree Graduate 47,927 Points

Hi nassim berkoun

The problem in your code is, that you declared the variable role twice - once with the keyword let, a second time as a constant. In addition, you're trying to uppercase a variable word inside the constant declaration, which doesn't exist.

To fix that, you just need to switch the first role with word and it should work:

let firstName = "NB";
let lastName = "berk";
let word = 'developer';
const role = word.toUpperCase('role');
const msg = firstName + " " + lastName + ':' + role + ".";