I am currently writing a piece of JavaScript that uses base 36 encoding.
I came across this problem:
parseInt("welcomeback",36).toString(36)
Appears to return "welcomebacg".
I tested this in the Chrome developer's console and Node.js with the same result.
Is there any logical explanation for this result?
The result of
parseInt("welcomeback",36)is larger thanNumber.MAX_SAFE_INTEGER(253-1) and thus cannot be accurately represented. A possible workaround is to perform base conversion withBigIntmanually.