Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Safari/605.1.15
Safari 12
Mac OS X 10.14
Desktop
6 years ago
Test name Executions per second
for...in 3484.0 Ops/sec
Object.keys+forEach (ES5) 4470.2 Ops/sec
for...of - keys (ES6) 4505.2 Ops/sec
for...of - values (ES6) 7666.4 Ops/sec
for...of - entries (ES8) 5370.7 Ops/sec
Object.entries (ES8) 5449.7 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)