capitalize function

PHOTO EMBED

Tue Dec 07 2021 10:03:03 GMT+0000 (Coordinated Universal Time)

Saved by @captm #javascript

function capitalize(word) {
    const firstLetter = word[0].toUpperCase()
    const restWord = word.substring(1).toLowerCase()
    return firstLetter + restWord
}
content_copyCOPY