JSFiddle - React, Tailwind, and code Playground
JavaScript
function myEvery(list, fun, withArgument) {
var i;
fun = fun || function(val) { return val };
arguments; // with this statement the time is 1300 ms
// if you comment it out -- 800 ms
for (i = 0; i < list.length; i++) {
if (!fun.call(list, list[i], i)) {
return false;
}
}
return true;
};
// Create a huge array
var list = [];
for (i = 1; i < 20000000; i++) {
list.push(i);
}
// Measure the time
t1 = (new Date).getTime();
myEvery(list);
t2 = (new Date).getTime();
alert(t2 - t1);