Hello,
I was working on an exercise in Javascript on Fixing capitalization. And I still don’t quite understand how the replace method works.
It is asked in this exercise to fix capitalization on cities names.
// I must fix the capitalization on : liVERpoOL
var name = “liVERpoOL”;
name = name.toLowerCase();
var firstLetter = name.slice(0,1); // ‘l’
name = name.replace(firstLetter, firstLetter.toUpperCase());
// name = Liverpool
But, there are two letters ‘L’ in the name “Liverpool”, why is the ‘L’ at the end is not replaced as well.
Thank you : )