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

104
Vistas
Numeric literals with underscores in JavaScript

I recently ran into this code and i was wandering if there is any difference of writing those numeric literals in JavaScript with or without underscores:

let number = 1234567890;
console.log(number);

let number2 = 123_4567_890;
console.log(number2);

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

So after further reading, I see that ECMAScript 2021 has a new feature called Numeric separators which is used for larger numbers that are hard to read without separating them..

To improve readability, this feature enables underscores as separators in numeric literals as you can see in the following example for all kinds of numeric literals:

const readableMiliion = 1_000_000;
const regularMiliion = 1000000;

console.log(readableMiliion);
console.log(regularMiliion);     

const decimal = 1_000_000.220_720;
const binary = 0b01010110_00111000;
const hexa = 0x40_76_38_6A_73;

console.log(decimal);  
console.log(binary);  
console.log(hexa);  

More about Numeric separators can be found here: https://v8.dev/features/numeric-separators

Or here https://writingjavascript.com/what-are-numeric-separators

about 4 years ago · Juan Pablo Isaza Denunciar

0

The point of the Numeric Seperatots is to visually aid developers when dealing with big numbers. They don't change the actual code or its meaning.

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