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 trialJAAFAR CHRAIBI
1,839 Pointsif i want to make only for example the first and the last letter in uppercase mode ..how can i do that ?
if i want to make mercury into all uppercase .. i shall use the toUppercase method. But, how about if i only want to make the first "r" and the "u" (in mercrury) into uppercase while letting all the other letters in lowercase ?
1 Answer
Adam N
70,280 PointsHere's a way I came up with:
let answer = "mercury"
let changed = answer[0].toUpperCase() + answer.slice(1, answer.length - 1) + answer[answer.length - 1].toUpperCase()
console.log(changed)
There might be a better way to do it. Let me know if this helps!