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 trialLevi Sanders
Full Stack JavaScript Techdegree Student 1,685 PointsDo I need to create a new variable in order to manipulate an existing value into all upper case letters?
This is challenge three on manipulating and transforming strings.
Jasper Peijer
45,009 PointsNo problem, just make sure to mark the post as answered if it helped out. :)
Steven Parker
231,248 PointsFYI: Answers can be marked and voted on, but not comments.
Jasper Peijer
45,009 PointsOh my bad, I didn't even realize the difference until now
Jasper Peijer
45,009 PointsFixed it
1 Answer
Jasper Peijer
45,009 PointsThere's a few options you have here:
You could call the uppercase function when initializing the variable:
let role = 'developer'.toUpperCase();
const msg = firstName + ' ' + lastName + ': ' + role;
You could reinitialize the variable like this:
let role = 'developer';
role = role.toUpperCase();
const msg = firstName + ' ' + lastName + ': ' + role;
You could put the uppercase version into a new variable:
let role = 'developer';
let roleUpper = role.toUpperCase();
const msg = firstName + ' ' + lastName + ': ' + roleUpper;
Or you could call the upper case function while initializing msg:
let role = 'developer';
const msg = firstName + ' ' + lastName + ': ' + role.toUpperCase();
The last one is most likely to pass the code challenge
Levi Sanders
Full Stack JavaScript Techdegree Student 1,685 PointsLevi Sanders
Full Stack JavaScript Techdegree Student 1,685 PointsThank you, Jasper!