Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

235
Vistas
Why does Number constructor fail to parse numbers with separators?

Since JavaScript has numeric separators (_, U+005F), why does Number("3_0") return NaN? Shouldn't it work like Number("0x08") which returns 8?

Number.isNaN(Number("3_0")) // true
Number.isNaN(Number(3_0))   // false
Number("3_0") === 30        // false
Number(3_0) === 30          // true
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

According to the spec, there are a few differences between the syntax accepted for numeric literals and the syntax accepted for a string value when being converted to a numeric value.

One of the differences is

A StringNumericLiteral cannot include a NumericLiteralSeparator.

If I have to guess, the reason is that accepting such characters would change the behavior of existing valid JavaScript code, which may break working applications.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda