{"ScriptPreparationCode":"const memoize = fn =\u003E {\r\n \tconst cache = {}; \r\n \treturn (...args) =\u003E {\r\n \targStr = JSON.stringify(args);\r\n\t\tcache[argStr] = cache[argStr] || fn(args);\r\n\r\n\t\treturn cache[argStr]; \r\n }\r\n}\r\n\r\nconst factorial = memoize((n) =\u003E {\r\n\tif (n \u003C= 1) return 1;\r\n\t\r\n \treturn n * factorial(n - 1);\r\n})","TestCases":[{"Name":"Factorial memoized","Code":"const memoize = fn =\u003E {\r\n \tconst cache = {}; \r\n \treturn (...args) =\u003E {\r\n \targStr = JSON.stringify(args);\r\n\t\tcache[argStr] = cache[argStr] || fn(args);\r\n\r\n\t\treturn cache[argStr]; \r\n }\r\n}\r\n\r\nconst factorial = memoize((n) =\u003E {\r\n\tif (n \u003C= 1) return 1;\r\n\t\r\n \treturn n * factorial(n - 1);\r\n});\r\n\r\nfactorial(10);","IsDeferred":false},{"Name":"Factorial plain","Code":"const factorial =(n) =\u003E {\r\n\tif (n \u003C= 1) return 1;\r\n\t\r\n \treturn n * factorial(n - 1);\r\n};\r\nfactorial(10)","IsDeferred":false}]}