javascriptnumbersecmascript-2021

Numeric literals with underscores in JavaScript


I recently ran into this code and I was wondering if there are any differences in writing those numeric literals in JavaScript with or without underscores:

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

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


Solution

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