Created
October 8, 2019 11:30
-
-
Save codebubb/45ed0dafd25c9c4bf9f43f5646a12151 to your computer and use it in GitHub Desktop.
First word title case, other words uppercase.
This file contains hidden or 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
| const firstWordTitleCase = str => str.split(' ').map((word, index) => index === 0 ? word[0].toUpperCase() + word.slice(1).toLowerCase() : word.toUpperCase()).join(' '); | |
| 'This is bird.it can fly.thank you.'.split('.').filter(line => line).map(firstWordTitleCase).join('\n'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment