parseInt(1/0, 18) == NaN, but
parseInt(1/0, 19) == 18 and
parseInt(1/0, 25) == 185011843?
(x > 0)/0 being equal to
Infinity, an object (constant?) in JS in the same vein as
NaN. It interacts with
NaN as well, in that
Infinity - Infinity or
Infinity / Infinity == NaN, but
Infinity + Infinity or
Infinity * Infinity == Infinity. Also there’s -Infinity, just for fun.
parseInt()ing the value infinity, internally it must run
.toString() to get the value which returns
"Infinity". Base 19 has the numbers
0-9 and then goes on to the letters
a-i (there’s a table in the stackoverflow article) of which the first letter of
"Infinity" matches, returning
18, when you up the base to 25, all the letters up to
n are parsed turning the ‘number’
185011843. Interestingly that also means that
parseInt(Infinity/Infinity, 25) == 14648!