Test name | Executions per second |
---|---|
Set | 761872.1 Ops/sec |
Merge | 1730753.9 Ops/sec |
For | 1196404.5 Ops/sec |
const a = { a: 1, b: 2 };
const b = { b: 3, c: 4 };
const s = new Set([
Object.keys(a),
Object.keys(b),
]);
const res = Array.from(s);
const c = { a, b };
const res = Object.keys(c);
const s = new Set();
for(const x in a) s.add(x);
for(const x in b) s.add(x);
const res = Array.from(s);