{"ScriptPreparationCode":"class ClassPoint {\r\n constructor(x, y) {\r\n this.x = x;\r\n this.y = y;\r\n }\r\n\r\n add(point) {\r\n this.x = this.x \u002B point.x\r\n this.y = this.y \u002B point.y\r\n }\r\n\r\n sub(point) {\r\n this.x = this.x - point.x\r\n this.y = this.y - point.y\r\n }\r\n}\r\nfunction FunctionPoint(x, y){\r\n\tthis.x = x;\r\n\tthis.y = y;\r\n}\r\n\r\nFunctionPoint.prototype.add = function(point){\r\n\t\tthis.x = this.x \u002B point.x\r\n this.y = this.y \u002B point.y\r\n}\r\n\r\nFunctionPoint.prototype.sub = function(point){\r\n\t\tthis.x = this.x - point.x\r\n this.y = this.y - point.y\r\n}\r\n\r\nfunction ObjectPoint(x, y){\r\n\treturn {\r\n \tx, \r\n \ty, \r\n \tadd:(point) =\u003E {\r\n this.x = this.x \u002B point.x\r\n this.y = this.y \u002B point.y\r\n \t},\r\n \tsub:(point) =\u003E {\r\n this.x = this.x - point.x\r\n this.y = this.y - point.y\r\n \t},\r\n } \r\n}\r\nclass Base {\r\n\tconstructor(x, y){\r\n\t\tthis.x = x;\r\n\t\tthis.y = y;\r\n }\r\n}\r\nclass ClassPoint2 extends Base {\r\n \r\n\tadd(point){\r\n\t\tthis.x = this.x \u002B point.x\r\n this.y = this.y \u002B point.y\r\n }\r\n\r\n\tsub(point){\r\n\t\tthis.x = this.x - point.x\r\n this.y = this.y - point.y\r\n }\r\n}","TestCases":[{"Name":"ES6 Class","Code":"\r\n\r\nvar p1 = new ClassPoint(10, 10);\r\nvar p2 = new ClassPoint(10, -10);\r\nvar sum = p1.add(p2);\r\nvar dif = p1.sub(p2);","IsDeferred":false},{"Name":"Function Prototype","Code":"var p1 = new FunctionPoint(10, 10);\r\nvar p2 = new FunctionPoint(10, -10);\r\nvar sum = p1.add(p2);\r\nvar dif = p1.sub(p2);","IsDeferred":false},{"Name":"Object Literal","Code":"var p1 = ObjectPoint(10, 10);\r\nvar p2 = ObjectPoint(10, -10);\r\nvar sum = p1.add(p2);\r\nvar dif = p1.sub(p2);","IsDeferred":false},{"Name":"Class extends","Code":"var p1 = new ClassPoint2(10, 10);\r\nvar p2 = new ClassPoint2(10, -10);\r\nvar sum = p1.add(p2);\r\nvar dif = p1.sub(p2);","IsDeferred":false}]}