{"ScriptPreparationCode":"\r\nvar bigArr = new Array(1000);\r\nfor (let i = 0; i \u003C 1000; \u002B\u002Bi) {\r\n bigArr[i] = i % 2 === 0 ? true : null;\r\n}\r\n\r\nvar smallArr = new Array(10);\r\nfor (let i = 0; i \u003C 10; \u002B\u002Bi) {\r\n smallArr[i] = i % 2 === 0 ? true : null;\r\n}\r\n\r\nvar vSmallArr = new Array(2);\r\nfor (let i = 0; i \u003C 10; \u002B\u002Bi) {\r\n vSmallArr[i] = i % 2 === 0 ? true : null;\r\n}\r\n","TestCases":[{"Name":"filter with push (bigArr)","Code":" const result = [];\r\n for (const item of bigArr) {\r\n if (item != null) {\r\n result.push(item);\r\n }\r\n }\r\n return result;","IsDeferred":false},{"Name":"filter with reduce (bigArr)","Code":"return bigArr.reduce(\r\n (arr, item) =\u003E (item != null ? [...arr, item] : arr),\r\n [],\r\n);","IsDeferred":false},{"Name":"filter with push (smallArr)","Code":" const result = [];\r\n for (const item of smallArr) {\r\n if (item != null) {\r\n result.push(item);\r\n }\r\n }\r\n return result;","IsDeferred":false},{"Name":"filter with reduce (smallArr)","Code":"return smallArr.reduce(\r\n (arr, item) =\u003E (item != null ? [...arr, item] : arr),\r\n [],\r\n);","IsDeferred":false},{"Name":"filter with push (vSmallArr)","Code":" const result = [];\r\n for (const item of vSmallArr) {\r\n if (item != null) {\r\n result.push(item);\r\n }\r\n }\r\n return result;","IsDeferred":false},{"Name":"filter with reduce (vSmallArr)","Code":"return vSmallArr.reduce(\r\n (arr, item) =\u003E (item != null ? [...arr, item] : arr),\r\n [],\r\n);","IsDeferred":false}]}