Test name | Executions per second |
---|---|
reduce | 13065.4 Ops/sec |
for | 13542.6 Ops/sec |
var list = [];
for (var i = 0; i < 1000; i++) {
list.push([0, 0, Math.floor(Math.random() * 10000).toString()]);
}
const result = list.reduce((acc, [, , value]) => {
const valueNum = Number(value);
if (valueNum > acc) {
return valueNum;
}
return acc;
}, 0);
let result = 0;
for (const [, , value] of list) {
const valueNum = Number(value);
if (valueNum > result) {
result = valueNum;
}
}