Correct a typo in "slice".

This commit is contained in:
Shlomi Fish
2017-12-12 12:55:59 +02:00
parent f5d0a9dd31
commit da37e7d585
2 changed files with 10 additions and 1 deletions

View File

@ -11,6 +11,7 @@
* [Anagrams of string (with duplicates)](#anagrams-of-string-with-duplicates) * [Anagrams of string (with duplicates)](#anagrams-of-string-with-duplicates)
* [Average of array of numbers](#average-of-array-of-numbers) * [Average of array of numbers](#average-of-array-of-numbers)
* [Capitalize first letter](#capitalize-first-letter) * [Capitalize first letter](#capitalize-first-letter)
* [Capitalize first letter.](#capitalize-first-letter.)
* [Count occurrences of a value in array](#count-occurrences-of-a-value-in-array) * [Count occurrences of a value in array](#count-occurrences-of-a-value-in-array)
* [Current URL](#current-url) * [Current URL](#current-url)
* [Curry](#curry) * [Curry](#curry)
@ -75,6 +76,14 @@ var average = arr =>
### Capitalize first letter ### Capitalize first letter
Use `slice(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);
```
### Capitalize first letter
Use `sice(0,1)` and `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 ```js

View File

@ -1,6 +1,6 @@
### Capitalize first letter ### Capitalize first letter
Use `sice(0,1)` and `toUpperCase()` to capitalize first letter, `slice(1)` to get the rest of the string. Use `slice(0,1)` and `toUpperCase()` to capitalize first letter, `slice(1)` to get the rest of the string.
```js ```js
var capitalize = str => str.slice(0, 1).toUpperCase() + str.slice(1); var capitalize = str => str.slice(0, 1).toUpperCase() + str.slice(1);