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

186 B

Distance between two points

Use Math.hypot() to calculate the Euclidean distance between two points.

const distance = (x0, y0, x1, y1) => Math.hypot(x1 - x0, y1 - y0);