As with a lot of things you'll run up against limitations of the fundamental data types used in JavaScript. In this case it seems to be a limit of the integer type.
The number 13245678901234567890 fits inside a 64-bit integer. Adding another digit pushes it into a range that cannot be represented that way so a floating-point number is required.
When testing this in different JavaScript engines you might get different values. Anything beyond 2147483648 is liable to end up cast as a floating point value.
Whenever you're doing mathematical calculations, try to avoid doing string computations on them. The string representation of a number is rather arbitrary and is not to be trusted.
What you should be doing is dividing by some factor of 10 and doing modulo-10 to get the individual digits.