{"ScriptPreparationCode":"var randomArray = [];\r\nvar arrayLength = 1E5\r\nvar comparisionFunction = (num) =\u003E num % 12 === 0 \u0026\u0026 num % 5 === 0 \u0026\u0026 num % 3 === 0\r\n\r\nlet i = 0;\r\nwhile (i \u003C= arrayLength) randomArray[i] = i\u002B\u002B;\r\n\r\nconsole.log(randomArray);\r\n\r\nvar filteredArray = []","TestCases":[{"Name":".filter()","Code":"filteredArray = randomArray.filter(comparisionFunction)","IsDeferred":false},{"Name":"Lodash _.filter()","Code":"filteredArray = _.filter(randomArray, comparisionFunction);","IsDeferred":false},{"Name":".map().filter() ","Code":"filteredArray = randomArray.map((num) =\u003E comparisionFunction(num) ? num : undefined).filter(Boolean)","IsDeferred":false},{"Name":"For loop","Code":"filteredArray = []\r\n\r\nfor (i = 0; i \u003C arrayLength; i\u002B\u002B) {\r\n\tif (randomArray[i] % 12 === 0 \u0026\u0026 randomArray[i] % 5 === 0 \u0026\u0026 randomArray[i] % 3 === 0) {\r\n filteredArray.push(randomArray[i])\r\n }\r\n}","IsDeferred":false},{"Name":".reduce()","Code":"filteredArray = randomArray.reduce((filteredArray, num) =\u003E {\r\n if (num % 12 === 0 \u0026\u0026 num % 5 === 0 \u0026\u0026 num % 3 === 0) {\r\n filteredArray.push(num)\r\n }\r\n return filteredArray\r\n}, [])","IsDeferred":false},{"Name":".reduce() with comparisionFunction","Code":"filteredArray = randomArray.reduce((filteredArray, num) =\u003E {\r\n if (comparisionFunction(num)) {\r\n filteredArray.push(num)\r\n }\r\n return filteredArray\r\n}, [])","IsDeferred":false}]}