Last active
February 3, 2019 19:21
-
-
Save talentedaamer/5d1c21719225e4c626abeb499692931c to your computer and use it in GitHub Desktop.
ucWords in JavaScript.
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
/** | |
* uppercase words in string. | |
* | |
* @param str | |
* @returns {string} | |
*/ | |
export function strUcWords ( str ) { | |
return ( str + '' ).replace(/\b[a-z]/g, function (letter) { | |
return letter.toUpperCase() | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment