{"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 with longer chain","Code":"function Point(x, y){\r\n\tthis.x = x;\r\n\tthis.y = y;\r\n}\r\n\r\nconst pointParent = {\r\n\tadd(point) {\r\n \treturn new Point(this.x \u002B point.x, this.y \u002B point.y);\r\n }\r\n};\r\n\r\nconst pointParentParent = {\r\n\tsub(point) {\r\n return new Point(this.x \u002B point.x, this.y \u002B point.y);\r\n }\r\n};\r\n\r\nObject.setPrototypeOf(pointParent, pointParentParent);\r\nPoint.prototype = pointParent;\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}]}