//When working with large numbers it can be hard to read them out,
//try to read this value for example:
const value = 100000000;
//Numeric separators are a JavaScript feature
//that allows you to use underscore as a separator in numeric literals,
//for example, you can write 10000 as 10_000.
//The feature works in recent versions of modern browsers as well as Node.js.
//When we apply this to the top example we can easily read out the value:
const value = 100_000_000;
//The numeric separator also works on octal, hex, and binary numbers:
const octalValue = 0o32_12;
const hexValue = 0xff_55_00;
const binaryValue = 0b1010_1011_1111;
//Now let's keep those numbers easy to read!
//https://writingjavascript.com/what-are-numeric-separators#:~:text=Numeric%20separators%20are%20a%20JavaScript,js.
The Underscore _ Identifier
A convention has also developed regarding the use of _,
which is frequently used to preface the name of an object's property
or method that is private. This is a quick and easy way to immediately
identify a private class member, and it is so widely used, that almost
every programmer will recognize it.
private void Foo() {}
this._foo();
Underscore is a JavaScript library that provides a whole mess of useful
functional programming helpers without extending any built-in objects.
var numbers = [10, 5, 100, 2, 1000];
_.min(numbers);
=> 2
var evens = _.filter([1, 2, 3, 4, 5, 6], function(num){ return num % 2 == 0; });
=> [2, 4, 6]