When it comes to javascript, numbers are stored as double-precision floats internally, with 53 bits dedicated to representing integer values. An example of this is the Number.MAX_SAFE_INTEGER
constant, calculated as Math.pow(2, 53) - 1
. Surprisingly, when I input Number.MAX_SAFE_INTEGER + 20
in the javascript console, it still provides the correct integer value output.
The question that arises is: How does javascript manage to handle numbers exceeding the limitations set by Number.MAX_SAFE_INTEGER
?