Imprimir del 1 al 100 sin bucles ni condicionales (v5)

Revision 5 of this benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Solución de @TarodBOFH
var arr = [function(val) {
 console.log(val);
 arr[Math.floor(val / 1000)](val + 1);
}, function() {}];
arr[0](1);
ready
Solución de @EtnasSoft
var y = x = 1000,
    foo0 = new Function();
var z = (function foo1() {
 console.log(y - x);
 eval('foo' + Math.floor((--x / 1000) + 1) + '();');
}());
ready
@epplestun
var a = [function(v) {
 console.log(v);
 a[Math.floor(v / 1000)](++v);
}, function() {}];
a[0](1);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.