Capitalize first letter, get current URL
This commit is contained in:
7
snippets/capitalize-first-letter.md
Normal file
7
snippets/capitalize-first-letter.md
Normal file
@ -0,0 +1,7 @@
|
||||
### Capitalize first letter
|
||||
|
||||
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);
|
||||
```
|
||||
7
snippets/current-URL.md
Normal file
7
snippets/current-URL.md
Normal file
@ -0,0 +1,7 @@
|
||||
### Current URL
|
||||
|
||||
Use `window.location.href` to get current URL.
|
||||
|
||||
```js
|
||||
var currentUrl = _ => window.location.href;
|
||||
```
|
||||
Reference in New Issue
Block a user