Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

117
Vistas
Number in Javascript changes after declaring it as a variable. Even parsing it from a string returns a wrong number

This is very weird please check it yourself.

Whenever I try to declare variable with the number 76561198322368902 it always changes to 76561198322368900 no matter what. Chrome Devtools Console Screenshot

Even when I pass the variable as a string and later parse to a number, it always changes to 76561198322368900.

I really don't know what to do. I never thought Integers were capable of such thing.

7 months ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

The "maximum safe integer" in JavaScript is 9007199254740991 - trying to use the number type beyond this can yield unpredictable results.

Use the BigInt type if you need a bigger number.

7 months ago · Juan Pablo Isaza Denunciar

0

You just exeeded the Number.MAX_SAFE_INTEGER

7 months ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos