What Does Underscore in a JavaScript Number Mean?

Use of underscores (_) in JavaScript number literals is meant to improve readability. This feature is known as numeric separators (which was introduced in ES12). It can be used like so:

// ES12+
const million = 1_000_000;

console.log(million); // 1000000
console.log(million === 1000000); // true

If you wish to deep-dive into the topic, then read the post about what numeric separators are in JavaScript.


Hope you found this post useful. It was published . Please show your love and support by sharing this post.