{"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":"Basic function","Code":"function Point(x, y){\r\n\treturn {\r\n \tx, \r\n \ty, \r\n };\r\n}\r\nconst add = (pointa, pointb) =\u003E({ x: pointa.x \u002B pointb.x, y: pointb.y \u002B pointb.y });\r\nconst sub = (pointa, pointb) =\u003E({ x: pointa.x - pointb.x, y: pointa.y - pointb.y });\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},{"Name":"Basic functions with object destructuring","Code":"function Point(x, y){\r\n\treturn {\r\n \tx, \r\n \ty, \r\n };\r\n}\r\nconst add = ({ x:xa, y:ya }, { x:xb, y:yb }) =\u003E({ x: xa \u002B xb, y: ya \u002B yb });\r\nconst sub = ({ x:xa, y:ya }, { x:xb, y:yb }) =\u003E({ x: xa - xb, y: ya - yb });\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}]}