Created
January 3, 2020 10:38
-
-
Save jportella93/50f9f6b189e17b88a0067e0d0de47da1 to your computer and use it in GitHub Desktop.
Uppercase first letter of a string 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
function capitalize(s) { | |
if (typeof s !== 'string') return ''; | |
return s.charAt(0).toUpperCase() + s.slice(1) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment