Numbers
More ways to write a number
let billion = 1e9; // 1 billion, literally: 1 and 9 zeroes
alert( 7.3e9 ); // 7.3 billions (7,300,000,000)
1e3 = 1 * 1000
1.23e6 = 1.23 * 1000000
let ms = 0.000001;
let ms = 1e-6; // six zeroes to the left from 1
// -3 divides by 1 with 3 zeroes
1e-3 = 1 / 1000 (=0.001)
// -6 divides by 1 with 6 zeroes
1.23e-6 = 1.23 / 1000000 (=0.00000123)Hex, binary and octal numbers
toString(base)
Two dots to call a method
Rounding
Imprecise calculations
The funny thing
Tests: isFinite and isNaN
parseInt and parseFloat
Other math functions
Last updated