Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
Chrome 65
Linux
Desktop
6 years ago
Test name Executions per second
for...in 3724.0 Ops/sec
Object.keys+forEach (ES5) 5222.3 Ops/sec
for...of - keys (ES6) 5252.8 Ops/sec
for...of - values (ES6) 4723.3 Ops/sec
for...of - entries (ES8) 3634.7 Ops/sec
Object.entries (ES8) 3716.6 Ops/sec
Script Preparation code:
Tests:
  • for...in

  • Object.keys+forEach (ES5)

  • for...of - keys (ES6)

  • for...of - values (ES6)

  • for...of - entries (ES8)

  • Object.entries (ES8)