for-in vs for-of (In Arrays)

Benchmark created by TheJetOU on


Setup

const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

Test runner

Ready to run.

Testing in
TestOps/sec
for-in
for (i in arr) {
    console.log(arr[i]);
}
ready
for-of
for (e of arr) {
    console.log(e);
}
ready

Revisions

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

  • Revision 1: published by TheJetOU on