3 ms·
> There is no extra code between the parens. You have a plus and an exponentiation in there. That's code. var n = 2**55 + 1 console.log(n) isOdd(n) n
by Dylan16807 16d ago
> There is no extra code between the parens.
You have a plus and an exponentiation in there. That's code.
var n = 2**55 + 1
console.log(n)
isOdd(n)
n is 36028797018963970. isOdd(n) is giving you the right answer. Putting the +1 inside the parentheses and talking about calculators is a sleight of hand that lets you pretend isOdd gets an odd number, but it doesn't. No odd numbers are around by the time isOdd actually does anything.
The problems are in + and/or our expectations of +. It does not output 36028797018963969, and we must acknowledge that.