Why is it that parseInt(8,3) == NaN and parseInt(16,3) == 1?
This is something people trip over all the time, even when they know about it. 🙂 You’re seeing this for the same reason parseInt(“1abc”) returns 1: parseInt stops at the first invalid character and returns whatever it has at that point. If there are no valid characters to parse, it returns NaN. parseInt(8, 3) means … Read more