Test name | Executions per second |
---|---|
For In | 399.3 Ops/sec |
Object keys forEach | 508.9 Ops/sec |
var obj = new Object()
var keys = (new Array(100)).fill(0).map((x, i) => { return i + 1 })
keys.forEach((x) => { obj['prop' + x] = x })
for (var key in obj) {
if (obj.hasOwnProperty(key)) console.log(obj[key])
}
Object.keys(obj).forEach(key => console.log(obj[key]))