Last active
February 4, 2021 08:24
-
-
Save ihorkatkov/a7b32b24c9bf00c01f3f to your computer and use it in GitHub Desktop.
[JS] Функция возвращает строку str с заглавным первым символом
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
function ucFirst(str) { | |
// только пустая строка в логическом контексте даст false | |
if (!str) return str; | |
return str[0].toUpperCase() + str.slice(1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment