Files
30-seconds-of-code/snippets/distance-between-two-points.md
2017-12-12 10:52:57 +02:00

8 lines
186 B
Markdown

### Distance between two points
Use `Math.hypot()` to calculate the Euclidean distance between two points.
```js
const distance = (x0, y0, x1, y1) => Math.hypot(x1 - x0, y1 - y0);
```