Merge pull request #10 from sompylasar/patch-1
Capitalize first letter: safe against empty string
This commit is contained in:
@ -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);
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user