const isEven = x => !!(~x & 1) const isEven2 = x => Boolean(~x & 1) const restEven = x => !(x % 2 !== 0) const n = Math.floor(Math.random() * 999)
Ready to run.
|Bitwise comparison (double negate operators)|
|Bitwise comparison (with boolean function)|
|classic isEven function (with suport to negative numbers)|
You can edit these tests or add more tests to this page by appending /edit to the URL.