js find distance between two points code example
Example 1: javascript distance between two points
Math.hypot(x2-x1, y2-y1)
Example 2: how to calculate distance between two points in javascript
function distance(x1, y1, x2, y2) {
return Math.hypot(x2-x1, y2-y1)
}