Skip to content

Instantly share code, notes, and snippets.

@iketari
Forked from anonymous/index.html
Created March 14, 2016 09:56
Show Gist options
  • Save iketari/3961736b0ef982f7115f to your computer and use it in GitHub Desktop.
Save iketari/3961736b0ef982f7115f to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/cilukoruce
<!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>
'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