diff --git a/README.md b/README.md index a9919919b..16a5dd1e1 100644 --- a/README.md +++ b/README.md @@ -74,10 +74,10 @@ var average = arr => ### Capitalize first letter -Use `toUpperCase()` to capitalize first letter, `slice(1)` to get the rest of the string. +Use `sice(0,1)` and `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); ``` ### Count occurrences of a value in array diff --git a/snippets/capitalize-first-letter.md b/snippets/capitalize-first-letter.md index 84447ee21..1310e76ed 100644 --- a/snippets/capitalize-first-letter.md +++ b/snippets/capitalize-first-letter.md @@ -1,6 +1,6 @@ ### Capitalize first letter -Use `toUpperCase()` to capitalize first letter, `slice(1)` to get the rest of the string. +Use `sice(0,1)` and `toUpperCase()` to capitalize first letter, `slice(1)` to get the rest of the string. ```js var capitalize = str => str.slice(0, 1).toUpperCase() + str.slice(1);