{"ScriptPreparationCode":null,"TestCases":[{"Name":"With inline statements","Code":"function clamp(n) {\r\n\tn \u003C 0 \u0026\u0026 (n = 0);\r\n\tn \u003E 100 \u0026\u0026 (n = 100);\r\n\r\n\treturn n;\r\n}\r\n\r\nconst n = clamp(150);","IsDeferred":false},{"Name":"With min() and max()","Code":"function clamp(n) {\r\n\treturn Math.min(Math.max(n, 0), 100);\r\n}\r\n\r\nconst n = clamp(150);","IsDeferred":false},{"Name":"With if statements","Code":"function clamp(n) {\r\n\tif (n \u003C 0) n = 0;\r\n\tif (n \u003E 100) n = 100;\r\n\r\n\treturn n;\r\n}\r\n\r\nconst n = clamp(150);","IsDeferred":false},{"Name":"With ternary operator #1","Code":"function clamp(n) {\r\n\tn \u003C 0 ? n = 0 : n;\r\n\tn \u003E 100 ? n = 100 : n;\r\n\r\n\treturn n;\r\n}\r\n\r\nconst n = clamp(150);","IsDeferred":false},{"Name":"With ternary operator #2","Code":"function clamp(n) {\r\n\treturn n = n \u003E 100 ?\r\n\t\t100 :\r\n\t\tn \u003C 0 ?\r\n\t\t\t0 :\r\n\t\t\tn;\r\n}\r\n\r\nconst n = clamp(150);","IsDeferred":false}]}