20.BigInt.html 548 B

123456789101112131415161718192021
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. </head>
  8. <body>
  9. <script>
  10. // BigInt 处理超大整数 精度不丢失
  11. // 9007199254740991 最大的安全整数
  12. let a = 9007199254740991n+ 1n;
  13. console.log(typeof a)
  14. console.log(9007199254740991n +200n)
  15. console.log(typeof BigInt(123))
  16. console.log(typeof 123n)
  17. console.log(9n > 55n)
  18. </script>
  19. </body>
  20. </html>