{"ScriptPreparationCode":"function factorial (num) {\r\n if (num \u003C 0) {\r\n throw new Error(\u0022Number cannot be negative.\u0022);\r\n }\r\n\r\n if (num % 1 !== 0) {\r\n throw new Error(\u0022Number must be an integer.\u0022);\r\n }\r\n\r\n // The base case\r\n if (num === 0 || num === 1) {\r\n return 1;\r\n }\r\n\r\n // The general case\r\n return num * factorial(num - 1);\r\n}","TestCases":[{"Name":"without console.time","Code":"factorial(20);","IsDeferred":false},{"Name":"with console.time","Code":"console.time(\u0027factorial\u0027);\r\nfactorial(20);\r\nconsole.timeEnd(\u0027factorial\u0027);","IsDeferred":false}]}