Can someone explain to me why parseInt adds / subtracts 1 from the values provided by me?
This is not the case, but IEEE-754 double-precision binary floating-point JavaScript numbers (even if you are using parseInt) that have only about 15 digits of precision. Your number is 17 digits, so it undergoes accuracy, and the lower digits become spongy.
- 9 007 199,254,740,991, Number.MAX_SAFE_INTEGER JavaScript. (, Number.MIN_SAFE_INTEGER, -9,007,99,254,740,991.)
, ~, & |, 32- , : -2 31 (-2,147,483,648) 2 31 -1 (2 147 483 647). , <<, >> >>>, 32- , 0 4 294 967 295. , , length 32- .