Home
<!DOCTYPE html> <html> <body> <h1>Demo: Integers in JavaScript</h1> <p id="p1">1234567890123456 = </p> <p id="p2">12345678901234569 = </p> <p id="p3">9999999999999998 = </p> <p id="p4">9999999999999999 = </p> <script> //16 digit integer var int1 = 1234567890123456; //will be 1234567890123456 //17 digit integer var int2 = 12345678901234569; //will be 12345678901234568 //16 digit integer var int3 = 9999999999999998; //will be 9999999999999998 //16 digit integer, last digit 9 var int4 = 9999999999999999; //will be 10000000000000000 document.getElementById("p1").textContent += int1; document.getElementById("p2").textContent += int2; document.getElementById("p3").textContent += int3; document.getElementById("p4").textContent += int4; </script> </body> </html>
Result: