Files
30-seconds-of-code/snippets/currentURL.md
Isabelle Viktoria Maciohsek 27c168ce55 Bake date into snippets
2021-06-13 13:55:00 +03:00

19 lines
317 B
Markdown

---
title: currentURL
tags: browser,beginner
firstSeen: 2017-12-18T11:05:03+02:00
lastUpdated: 2020-10-20T11:46:23+03:00
---
Returns the current URL.
- Use `Window.location.href` to get the current URL.
```js
const currentURL = () => window.location.href;
```
```js
currentURL(); // 'https://www.google.com/'
```