reduce does not initialize accumulator to zero? Because the example below happens, I can not understand.
const r = (acc, curr) => acc |= (1 << curr);
let x;
x |= (1 << 0);
console.log(x); // -> 1 - OK
console.log([0].reduce(r)); // -> 0 - ???
And how do I get 1 correctly, as I expect, without doing something like this [0, 0].reduces(r);
.