Advertisement
kstoyanov

09. Point Distance

Sep 20th, 2020
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Point {    
  2.  
  3.     constructor(x, y) {
  4.         this.x = x;
  5.         this.y = y;
  6.     }
  7.  
  8.     static distance = (p1, p2) => { return Math.sqrt((p1.x - p2.x) ** 2 + (p1.y - p2.y) ** 2);}
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement