Created
March 14, 2016 09:49
-
-
Save anonymous/c09d9061d398d5c8e593 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/cilukoruce
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
'use script'; | |
class Point { | |
constructor(x, y) { | |
this.x = x; | |
this.y = y; | |
} | |
static distance(a, b) { | |
const dx = a.x - b.x; | |
const dy = a.y - b.y; | |
return Math.sqrt(dx*dx + dy*dy); | |
} | |
} | |
const p1 = new Point(5, 5); | |
const p2 = new Point(10, 10); | |
console.log(Point.distance(p1, p2)); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">'use script'; | |
class Point { | |
constructor(x, y) { | |
this.x = x; | |
this.y = y; | |
} | |
static distance(a, b) { | |
const dx = a.x - b.x; | |
const dy = a.y - b.y; | |
return Math.sqrt(dx*dx + dy*dy); | |
} | |
} | |
const p1 = new Point(5, 5); | |
const p2 = new Point(10, 10); | |
console.log(Point.distance(p1, p2));</script></body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use script'; | |
class Point { | |
constructor(x, y) { | |
this.x = x; | |
this.y = y; | |
} | |
static distance(a, b) { | |
const dx = a.x - b.x; | |
const dy = a.y - b.y; | |
return Math.sqrt(dx*dx + dy*dy); | |
} | |
} | |
const p1 = new Point(5, 5); | |
const p2 = new Point(10, 10); | |
console.log(Point.distance(p1, p2)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment