how to use a loop to cap the last letter of a string
let x = "hello my name is chrono"
let reg = x.split(' ')
for(let i = 0; i < reg.length; i++) {
reg[i] = reg[i][0].toUpperCase() + reg[i].substr(1)
}
reg.join(" ")
console.log(reg)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> The code above is to change the first letter of the string to uppercase.
The next lesson is to change the last letter instead of the first
Please help
let reg = x.split(' ')
for(let i = 0; i < reg.length; i++) {
reg[i] = reg[i][0].toUpperCase() + reg[i].substr(1)
}
reg.join(" ")
console.log(reg)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> The code above is to change the first letter of the string to uppercase.
The next lesson is to change the last letter instead of the first
Please help
