ucfirst(); lcfirst(); ucwords(); in typescript
Created: 4 Feb 2022,Updated: 4 Feb 2022,(0) fork,(0) stars,(0) comments,
const ucFirst = (str: string) =>
str
.split("")
.map((v, i) => (i === 0 ? v.toUpperCase() : v))
.join("");
const lcFirst = (str: string) =>
str
.split("")
.map((v, i) => (i === 0 ? v.toLowerCase() : v))
.join("");
const ucWords = (str: string) =>
str
.split(" ")
.map((i) => ucFirst(i))
.join(" ");