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

Christina Rongo
PLUS
Christina Rongo
Courses Plus Student 598 Points

javascript basics: 3rd challenge on manipulating strings. toUpperCase: What the F am I doing wrong?!

app.js
let firstName = "Christina";
let lastName = "Rongo";
let role = 'developer';
let msg = firstName + " " + lastName + ":" + role.toUpperCase() + " ";

2 Answers

Christina Rongo
PLUS
Christina Rongo
Courses Plus Student 598 Points

Thank you. That worked. Is that really the case when actually coding, or is this a glitch in the challenge? Also, why does the " " suddenly not need to be there after role.toUpperCase() ? best! Christina

Mark Sebeck
Mark Sebeck
Treehouse Moderator 37,799 Points

You are welcome. It's really picky when building string that the spelling, capitalization and spelling has to be exact. Which is sometimes frustrating because you have the code correct and understand it just have a minor typo. You never need a + " " after toUpperCase(). Only if you are building a string and need a space. Like if you wanted add another string after role you might want to add a space.

Mark Sebeck
MOD
Mark Sebeck
Treehouse Moderator 37,799 Points

It's the spacing. It's really picky. You need a space after the colon and no space at the end

let msg = firstName + " " + lastName + ": " + role.toUpperCase();