Test name | Executions per second |
---|---|
ternary | 51657.0 Ops/sec |
if | 49546.0 Ops/sec |
for (let i = 0; i < 1000; i++) {
const rnd = Math.random();
const value = rnd < .5 ? 'min' : 'max'
}
for (let i = 0; i < 1000; i++) {
const rnd = Math.random();
let value;
if (rnd < .5) {
value = 'min';
} else {
value = 'max';
}
}