I need to understand this part of the code
let x = "hello my name is chrono"
const finalSentence = x.replace(/\S\w | \s\w/g, letter => letter.toUpperCase());
>>>>>>>>>>>>> I need to understand this part of the code >>>>>>>>>>>> letter => letter.toUpperCase()
Is it like writing this
function letter(letter) {
letter.toUpperCase()
return letter
}
const finalSentence = x.replace(/\S\w | \s\w/g, letter => letter.toUpperCase());
>>>>>>>>>>>>> I need to understand this part of the code >>>>>>>>>>>> letter => letter.toUpperCase()
Is it like writing this
function letter(letter) {
letter.toUpperCase()
return letter
}