Advertisement
Spocoman

05. Distance between Points

Jan 15th, 2022
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(x1, y1, x2, y2) {
  2.    
  3.     let x = Math.abs(x1 - x2);
  4.     let y = Math.abs(y1 - y2);
  5.    
  6.     console.log(Math.sqrt(x * x + y * y));
  7.    
  8. }
  9.  
  10.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement