mirror of
https://github.com/github/codeql.git
synced 2025-12-20 18:56:32 +01:00
17 lines
284 B
JavaScript
17 lines
284 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');
|
|
|
|
var pyth = new Point(3, 4);
|
|
console.log(pyth.distance()); |