Files
30-seconds-of-code/snippets/distance-between-two-points.md
2017-12-08 16:09:05 +02:00

9 lines
223 B
Markdown

### Distance between two points
Use `Math.pow()` and `Math.sqrt()` to calculate the Euclidean distance between two points.
```js
var distance = x0, y0, x1, y1 =>
Math.sqrt(Math.pow(x1-x0, 2) + Math.pow(y1 - y0, 2))
```