-
-
Save piotrlo/c0f10064d4c735db091c18d564ece803 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
// Capitalize all words of a string | |
function capitalize(string) { | |
return string.replace(/\b[a-z]/g, (char) => char.toUpperCase()); | |
} | |
capitalize('overment rocks!'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment