Files
30-seconds-of-code/snippets/currentURL.md
2020-03-06 09:57:40 +02:00

17 lines
238 B
Markdown

---
title: currentURL
tags: browser,url,beginner
---
Returns the current URL.
Use `window.location.href` to get the current URL.
```js
const currentURL = () => window.location.href;
```
```js
currentURL(); // 'https://google.com'
```