{"ScriptPreparationCode":null,"TestCases":[{"Name":"ES6 Class","Code":"class Point {\r\n\tconstructor(x, y) {\r\n\t\tthis.x = x;\r\n\t\tthis.y = y;\r\n }\r\n\r\n\tadd(point) {\r\n\t\treturn new Point(this.x \u002B point.x, this.y \u002B point.y);\r\n }\r\n\r\n\tsub(point) {\r\n\t\treturn new Point(this.x - point.x, this.y - point.y);\r\n }\r\n}\r\n\r\nvar p1 = new Point(10, 10);\r\nvar p2 = new Point(10, -10);\r\nvar sum = p1.add(p2);\r\nvar dif = p1.sub(p2);","IsDeferred":false},{"Name":"Function Prototype","Code":"function Point(x, y) {\r\n\tthis.x = x;\r\n\tthis.y = y;\r\n}\r\n\r\nPoint.prototype.add = function(point) {\r\n return new Point(this.x \u002B point.x, this.y \u002B point.y);\r\n}\r\n\r\nPoint.prototype.sub = function(point) {\r\n\treturn new Point(this.x - point.x, this.y - point.y);\r\n}\r\n\r\nvar p1 = new Point(10, 10);\r\nvar p2 = new Point(10, -10);\r\nvar sum = p1.add(p2);\r\nvar dif = p1.sub(p2);\r\n","IsDeferred":false},{"Name":"Object Literal","Code":"function Point(x, y) {\r\n\treturn {\r\n \tx, \r\n \ty, \r\n \tadd: (point)=\u003EPoint(this.x \u002B point.x, this.y \u002B point.y),\r\n\t \tsub: (point)=\u003EPoint(this.x - point.x, this.y - point.y)\r\n } \r\n}\r\n\r\nvar p1 = Point(10, 10);\r\nvar p2 = Point(10, -10);\r\nvar sum = p1.add(p2);\r\nvar dif = p1.sub(p2);","IsDeferred":false},{"Name":"Object \u0026 Functions","Code":"function Point(x, y) {\r\n\treturn {\r\n \tx, \r\n \ty, \r\n } \r\n}\r\n\r\nfunction add(a, b) {\r\n\treturn Point(a.x \u002B b.x, a.y \u002B b.y);\r\n}\r\n\r\nfunction sub(a, b) {\r\n\treturn Point(a.x - b.x, a.y - b.y);\r\n}\r\n\r\nvar p1 = Point(10, 10);\r\nvar p2 = Point(10, -10);\r\nvar sum = add(p1, p2);\r\nvar dif = sub(p1, p2);","IsDeferred":false}]}