Run details:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 YaBrowser/18.9.1.954 Yowser/2.5 Safari/537.36
Yandex Browser 18
Windows
Desktop
6 years ago
Test name Executions per second
for...in 1019.6 Ops/sec
Object.keys+forEach (ES5) 1495.4 Ops/sec
for...of - keys (ES6) 1513.2 Ops/sec
for...of - values (ES6) 1511.8 Ops/sec
for...of - entries (ES8) 913.7 Ops/sec
Object.entries (ES8) 1234.3 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)