{"ScriptPreparationCode":null,"TestCases":[{"Name":"direct","Code":"const fizzBuzz = function(n) {\r\n const result = new Array(n);\r\n for (let i = 1; i \u003C= n; \u002B\u002Bi) {\r\n let s = i.toString();\r\n if (i % 3 === 0) {\r\n s = \u0027Fizz\u0027;\r\n }\r\n if (i % 5 === 0) {\r\n s = \u0027Buzz\u0027;\r\n }\r\n if (i % 3 === 0 \u0026\u0026 i % 5 === 0) {\r\n s = \u0027FizzBuzz\u0027;\r\n }\r\n result[i-1] = s;\r\n }\r\n return result;\r\n}\r\nfizzBuzz(100);","IsDeferred":false},{"Name":"ordered direct","Code":"const fizzBuzz = function(n) {\r\n const result = new Array(n);\r\n for (let i = 1; i \u003C= n; \u002B\u002Bi) {\r\n if (i % 3 === 0 \u0026\u0026 i % 5 === 0) {\r\n result[i-1] = \u0027FizzBuzz\u0027;\r\n } else if (i % 3 === 0) {\r\n result[i-1] = \u0027Fizz\u0027;\r\n } else if (i % 5 === 0) {\r\n result[i-1] = \u0027Buzz\u0027;\r\n } else {\r\n result[i-1] = i.toString();\r\n }\r\n }\r\n return result;\r\n};\r\nfizzBuzz(100);","IsDeferred":false},{"Name":"divisible by 15","Code":"const fizzBuzz = function(n) {\r\n const result = new Array(n);\r\n for (let i = 1; i \u003C= n; \u002B\u002Bi) {\r\n if (i % 15 === 0) {\r\n result[i-1] = \u0027FizzBuzz\u0027;\r\n } else if (i % 3 === 0) {\r\n result[i-1] = \u0027Fizz\u0027;\r\n } else if (i % 5 === 0) {\r\n result[i-1] = \u0027Buzz\u0027;\r\n } else {\r\n result[i-1] = i.toString();\r\n }\r\n }\r\n return result;\r\n};\r\nfizzBuzz(100);","IsDeferred":false},{"Name":"concatenate","Code":"const fizzBuzz = function(n) {\r\n const result = new Array(n);\r\n for (let i = 1; i \u003C= n; \u002B\u002Bi) {\r\n const f = i % 3 === 0 ? \u0027Fizz\u0027 : \u0027\u0027;\r\n const b = i % 5 === 0 ? \u0027Buzz\u0027 : \u0027\u0027;\r\n let str = \u0060${f}${b}\u0060;\r\n if (!str) {\r\n str = i.toString();\r\n }\r\n result[i-1] = str;\r\n }\r\n return result;\r\n};\r\nfizzBuzz(100);","IsDeferred":false},{"Name":"skip iterations","Code":"const fizzBuzz = function(n) {\r\n const result = Array(n).fill(\u0027\u0027);\r\n for (let i = 2; i \u003C n; i \u002B= 3) {\r\n result[i] \u002B= \u0027Fizz\u0027;\r\n }\r\n for (let i = 4; i \u003C n; i \u002B= 5) {\r\n result[i] \u002B= \u0027Buzz\u0027;\r\n }\r\n for (let i = 0; i \u003C n; \u002B\u002Bi) {\r\n if (!result[i]) {\r\n result[i] = (i\u002B1).toString();\r\n }\r\n }\r\n return result;\r\n}\r\nfizzBuzz(100);","IsDeferred":false},{"Name":"functional","Code":"const fizzBuzz = function(n) {\r\n return Array\r\n .from({length: n}, (_,i) =\u003E \u002B\u002Bi)\r\n .map(number =\u003E {\r\n const f = number % 3 === 0 ? \u0027Fizz\u0027 : \u0027\u0027;\r\n const b = number % 5 === 0 ? \u0027Buzz\u0027 : \u0027\u0027;\r\n return \u0060${f}${b}\u0060 || number.toString();\r\n });\r\n};\r\nfizzBuzz(100);","IsDeferred":false},{"Name":"binary","Code":"const fizzBuzz = function(n) {\r\n const result = new Array(n);\r\n const values = [null, \u0027Fizz\u0027, \u0027Buzz\u0027, \u0027FizzBuzz\u0027];\r\n for (let i = 1; i \u003C= n; \u002B\u002Bi) {\r\n values[0] = i.toString();\r\n result[i-1] = values[(i % 3 === 0 ? 1 : 0) \u002B 2 * (i % 5 === 0 ? 1 : 0)];\r\n }\r\n return result;\r\n};\r\nfizzBuzz(100);","IsDeferred":false},{"Name":"cache","Code":"const fizzBuzz = function(n) {\r\n return [\u00221\u0022,\u00222\u0022,\u0022Fizz\u0022,\u00224\u0022,\u0022Buzz\u0022,\u0022Fizz\u0022,\u00227\u0022,\u00228\u0022,\u0022Fizz\u0022,\u0022Buzz\u0022,\u002211\u0022,\u0022Fizz\u0022,\u002213\u0022,\u002214\u0022,\u0022FizzBuzz\u0022,\u002216\u0022,\u002217\u0022,\u0022Fizz\u0022,\u002219\u0022,\u0022Buzz\u0022,\u0022Fizz\u0022,\u002222\u0022,\u002223\u0022,\u0022Fizz\u0022,\u0022Buzz\u0022,\u002226\u0022,\u0022Fizz\u0022,\u002228\u0022,\u002229\u0022,\u0022FizzBuzz\u0022,\u002231\u0022,\u002232\u0022,\u0022Fizz\u0022,\u002234\u0022,\u0022Buzz\u0022,\u0022Fizz\u0022,\u002237\u0022,\u002238\u0022,\u0022Fizz\u0022,\u0022Buzz\u0022,\u002241\u0022,\u0022Fizz\u0022,\u002243\u0022,\u002244\u0022,\u0022FizzBuzz\u0022,\u002246\u0022,\u002247\u0022,\u0022Fizz\u0022,\u002249\u0022,\u0022Buzz\u0022,\u0022Fizz\u0022,\u002252\u0022,\u002253\u0022,\u0022Fizz\u0022,\u0022Buzz\u0022,\u002256\u0022,\u0022Fizz\u0022,\u002258\u0022,\u002259\u0022,\u0022FizzBuzz\u0022,\u002261\u0022,\u002262\u0022,\u0022Fizz\u0022,\u002264\u0022,\u0022Buzz\u0022,\u0022Fizz\u0022,\u002267\u0022,\u002268\u0022,\u0022Fizz\u0022,\u0022Buzz\u0022,\u002271\u0022,\u0022Fizz\u0022,\u002273\u0022,\u002274\u0022,\u0022FizzBuzz\u0022,\u002276\u0022,\u002277\u0022,\u0022Fizz\u0022,\u002279\u0022,\u0022Buzz\u0022,\u0022Fizz\u0022,\u002282\u0022,\u002283\u0022,\u0022Fizz\u0022,\u0022Buzz\u0022,\u002286\u0022,\u0022Fizz\u0022,\u002288\u0022,\u002289\u0022,\u0022FizzBuzz\u0022,\u002291\u0022,\u002292\u0022,\u0022Fizz\u0022,\u002294\u0022,\u0022Buzz\u0022,\u0022Fizz\u0022,\u002297\u0022,\u002298\u0022,\u0022Fizz\u0022,\u0022Buzz\u0022];\r\n};\r\nfizzBuzz(100);","IsDeferred":false}]}