es6-for of (v2)

Revision 2 of this benchmark created on


Setup

const arr = [1, 2, 3, 4, 5]; 

Test runner

Ready to run.

Testing in
TestOps/sec
for of
for (const num of arr) {  
  const result = num * 2;  
}
ready
for循环
for (let i = 0; i < arr.length; i++) {  
  const result = arr[i] * 2;  
}
ready
for of (通过babel转译es5)
for (var _i = 0, _arr = arr; _i < _arr.length; _i++) {
  var num = _arr[_i];
  var result = num * 2;
}
ready

Revisions

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