capitalize

PHOTO EMBED

Mon Oct 31 2022 00:26:12 GMT+0000 (Coordinated Universal Time)

Saved by @davidmchale #substring #slice

function capitalize(word, capitalize) {
        return word.slice(0, 1).toUpperCase() + word.slice(1).toLowerCase();
}

// Sample usage - do not modify
console.log(capitalize("sam")); // "Sam"
console.log(capitalize("ALEX")); // "Alex"
console.log(capitalize("chARLie")); // "Charlie"
content_copyCOPY