Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var lineConstructor = function lineConstructor(input0,input1,input2,input3) {
- return {
- point1: {
- x: input0,
- y: input1
- },
- point2: {
- x: input2,
- y: input3
- },
- calculateLine: function () {
- return (Math.sqrt(Math.abs(this.input0.x - this.input1.x) *
- Math.abs(input2.y - this.input3.y)));
- }
- }
- }
- var line1 = lineConstructor(3, 4, 5, 6);
- var line2 = lineConstructor(-2, -5, 7, 10);
- console.log(line1.calculateLine());
Advertisement
Add Comment
Please, Sign In to add comment