While, one-time var, not equal vs for

Benchmark created by Jaume on


Setup

var values = ['a1','a2','a3','a4','a5'];

Test runner

Ready to run.

Testing in
TestOps/sec
while
var l = values.length;
var i = 0-1;
while (i++ != l-1) {
 console.log(values[i]);
}
ready
for
var nCounter = 0;
var nValuesLength = values.length;

for( ; nCounter < nValuesLength ; nCounter++ ){
console.log(values[nCounter ]);
}
ready

Revisions

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

  • Revision 1: published by Jaume on