{"ScriptPreparationCode":null,"TestCases":[{"Name":"flatmap","Code":"let inp = new Array(10000).fill(0)\r\nlet sep = 1\r\ninp = inp.flatMap((e, index) =\u003E index ? [sep, e] : e);\r\nconsole.log(inp.length, inp[0], inp[1], \u0022...\u0022, inp.at(-2), inp.at(-1))","IsDeferred":false},{"Name":"splice loop","Code":"let inp = new Array(10000).fill(0)\r\nlet sep = 1\r\ni = inp.length;\r\nwhile (--i) inp.splice(i, 0, sep);\r\nconsole.log(inp.length, inp[0], inp[1], \u0022...\u0022, inp.at(-2), inp.at(-1))","IsDeferred":false},{"Name":"reduce","Code":"let inp = new Array(10000).fill(0)\r\nlet sep = 1\r\ninp = inp.reduce((r, a) =\u003E r.concat(a, sep), []);\r\ninp.pop();\r\nconsole.log(inp.length, inp[0], inp[1], \u0022...\u0022, inp.at(-2), inp.at(-1))","IsDeferred":false},{"Name":"copy loop","Code":"let inp = new Array(10000).fill(0)\r\nlet sep = 1\r\nlet tar = new Array(inp.length * 2 - 1)\r\nfor (let i = inp.length - 1; i \u003E -1; --i) {\r\n tar[i * 2] = inp[i]\r\n tar[i * 2 - 1] = sep\r\n}\r\ninp = tar;\r\nconsole.log(inp.length, inp[0], inp[1], \u0022...\u0022, inp.at(-2), inp.at(-1))","IsDeferred":false}]}