for loop (v2)

Revision 2 of this benchmark created on


Setup

const array = [1,2,3,4,5,6,7,8,9,0];

Test runner

Ready to run.

Testing in
TestOps/sec
for loop
for (let i=0; i<array.length; i++) {
	const item = array[i];
	console.log('normal: ', item);
}
ready
for loop 2
let item = null;
for (let i=0, item; item = array[i]; i++) {
;
	console.log('abnormal: ', item);
}
ready
foreach
array.forEach(x => console.log('forEach:', x));
ready

Revisions

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