Created
October 23, 2019 05:06
-
-
Save pSapien/2667694c17c3b0da83742aa68bdb29c7 to your computer and use it in GitHub Desktop.
capitalize the first character of a string
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
/** | |
* @params{string} | |
* capitalizes the first character of the string | |
* capitalize('small') => 'Small' | |
*/ | |
function capitalize(str) { | |
return str.charAt(0).toUpperCase() + str.slice(1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment