9876543210223023 exceeds the value of 9007199254740991, which is represented by Number.MAX_SAFE_INTEGER
.
In JavaScript, the Number type consists of a 64-bit floating point number.
When dealing with numbers outside the range, the machine epsilon plays a role and rounds the number to the closest representable value, such as 9876543210223024 in this scenario.
If you need to work with numbers of this magnitude, consider using a biginteger library.
For modern browsers like Chrome/Chromium, there may already be support for the "BigInteger" type built-in.
If so: BigInt("9876543210223023", 10)
Alternatively, utilize the provided BigInt-library as a polyfill.