Test name | Executions per second |
---|---|
for..of | 146496000.0 Ops/sec |
Array.find() | 160948016.0 Ops/sec |
<div id='test'></div>
var arr = ['hello', 'a', 'b'];
let val;
for (var value of arr) {
if (value === 'b') {
val = value;
}
}
var arr = ['hello', 'a', 'b'];
let val = arr.find(node => node.id === 'b');