mirror of
https://github.com/github/codeql.git
synced 2025-12-21 19:26:31 +01:00
17 lines
290 B
JavaScript
17 lines
290 B
JavaScript
// point.js
|
|
function Point(x, y) {
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
|
|
Point.prototype.distance = function() {
|
|
return Math.sqrt(this.x*this.x+this.y*this.y);
|
|
};
|
|
|
|
module.exports = Point;
|
|
|
|
// client.js
|
|
var Point = require('./point').Point;
|
|
|
|
var pyth = new Point(3, 4);
|
|
console.log(pyth.distance()); |