Test case name | Result |
---|---|
const array = [1, 2, 3]; const hasValue = value => array.includes(value); | |
const set = new Set([1, 2, 3]); const hasValue = value => set.has(value); |
Test name | Executions per second |
---|---|
const array = [1, 2, 3]; const hasValue = value => array.includes(value); | 407154.8 Ops/sec |
const set = new Set([1, 2, 3]); const hasValue = value => set.has(value); | 384482.1 Ops/sec |