Is Even with % or &

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
With &
const isEven = (n) => (n & 1) === 0;
isEven(2)
isEven(1)
ready
With %
const isEven = (n) => (n % 2) === 0;
isEven(2)
isEven(1)
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.