diff --git a/snippets/capitalize-first-letter.md b/snippets/capitalize-first-letter.md index 56e42eab5..84447ee21 100644 --- a/snippets/capitalize-first-letter.md +++ b/snippets/capitalize-first-letter.md @@ -3,5 +3,5 @@ Use `toUpperCase()` to capitalize first letter, `slice(1)` to get the rest of the string. ```js -var capitalize = str => str[0].toUpperCase() + str.slice(1); +var capitalize = str => str.slice(0, 1).toUpperCase() + str.slice(1); ```