There isn’t a good way to create a visual separation between digits in larger numbers. Take Christophe Porteneuve’s example of
1000000000, for instance. The number is difficult to parse. Is it 1 trillion? 100 million? 10 million? 10 trillion? 🤷♂️
100000000 can be turned into
1_000_000_000 (congrats to those who put money on a trillion). Sure, an underscore is not a comma, but it’s a heckuva lot better than before!
The most obvious practical use is finance but an underscore can be used to separate HEX values, Binary, BigInt, and more.
Much of this will be familiar to those among us who have used numeric separators in other languages like Java, Ruby, Rust, Swift, and others. Many of whom are rolling their eyes at this small improvement.
And, yes, it is a somewhat minor syntactical change but we tend to read code way more than we write, so increasing legibility is really important and helpful. And now that ESLint supports it we may start seeing rules enforcing its use. It’ll make reading numbers
1_000 times easier. 😉
To the future!