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

Fidelis Chime
Fidelis Chime
6,077 Points

toUpperCase

let firstName = 'fidel'; let lastName = 'chyme'; let role = 'developer'; role = role.toUpperCase(); let msg = `${firstNa

app.js
let firstName = 'fidel';
let lastName = 'chyme';
let role = 'developer';
role = role.toUpperCase();
let msg = `${firstName} ${lastName} : ${role}`;
Fidelis Chime
Fidelis Chime
6,077 Points

Please can someone look into the above code, as it works on the browser

3 Answers

Steven Parker
Steven Parker
231,261 Points

The challenge should have given you this clue: Bummer: The original string stored in role should not be modified.

So instead of assigning the modified value back to "role", just modify it as you assign "msg".

How would you modify it? i tried giving it a new Var ex shout = role.toUpperCase() and it does not work

It works in my vs code, can't figure out why it doesn't work in a task. Help please.

let firstName = "Anna"; let lastName = "Terentjeva"; let role = "developer"; role = role.toUpperCase(); let msg = ${firstName} ${lastName}: ${role}.; console.log(msg);

Steven Parker
Steven Parker
231,261 Points

You're doing the same thing as the original poster by changing what is in "role". That's not what the instructions ask for. You should apply the method only when you are assigning "msg". Also, there should be no punctuation at the end of the string.

For future issues, always create a fresh question instead of asking one as an "answer". It will reach more students that way.