oring and array

JavaScript performance comparison

Test case created by musefan

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  var a = [true,false,true,true,false];

};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
some
var result = a.some(function(value) {
    return value;
});
pending…
not not what now?
!!~a.indexOf(true)
pending…
KISS
var result = a.indexOf(true) != -1;
pending…
reduce
a.reduce(function(prev, curr) {
  return prev || curr;
}, false);
pending…
loop
var a = [false,false,false,false,false]
var result = a[0];
for(i=0;i<a.length;i++){
    result = result || a[i]
}
alert(result);
pending…

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

Compare results of other browsers

0 Comments