Build README
This commit is contained in:
7
snippets/capitalize-first-letter-of-every-word.md
Normal file
7
snippets/capitalize-first-letter-of-every-word.md
Normal file
@ -0,0 +1,7 @@
|
||||
### Capitalize first letter of every word
|
||||
|
||||
Use `replace()` to match the first character of each word and `toUpperCase()` to capitalize it.
|
||||
|
||||
```js
|
||||
var capitalizeEveryWord = str => str.replace(/\b[a-z]/g, char => char.toUpperCase());
|
||||
```
|
||||
Reference in New Issue
Block a user