Created
January 11, 2022 07:54
-
-
Save afrijaldz/5257c34f220c961b58f80e949f68bdd3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const capitalizeFirstChar = (char) => { | |
const result = char | |
.split(" ") | |
.map((c) => { | |
const first = | |
c.slice(0, 1) === "x" ? c.slice(0, 1) : c.slice(0, 1).toUpperCase(); | |
const leas = c.slice(1); | |
return `${first}${leas}`; | |
}) | |
.join(" "); | |
return result; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment