if you type 78764357878563812 in chrome or in safari, then you get
If you do
for(var i = 0; i < 30; i++){console.log(i + \" == \" + 7876435787856
There are no integers in Javascript.
Numbers are double precision floating point, which gives you a precision of 15-16 digits. This is consistent with your results.
As I suspected... so there is no integers in JS.
So that is you don't have integers in js like you would spec in other langs (they are thus most like an alias), altought they are confusing if you come from other language that has int and unsigned int and know the behaviour in the back.
So for handle big ints, I suguest to myself something like
if(someInt+1 == someInt || someInt-1 == someInt) { //use big number }
Or something like that, so far I only searched for BigInt libs in js, found one result here for integers
And for floating point
So I have my 3 questions ansered.
which is the max number and what is the anterior number in js. The same than a Float can give... but you will start getting gaps in some place... that is adding +1 to it will give the same number instead of consecutive.... so you have 2 "max ints" the max int that you can have adding +1 and get the next number and the max integer that is hable to give a 64-bit floating point number.
how to handle or know when this behaviour for integers will start happening.
Use one of the 2 above: a big int library or the check "someInt+1 == someInt || someInt-1 == someInt".