number

let billion = 1e9;  // 1 billion, literally: 1 and 9 zeroes
console.log( 7.3e9 );  // 7.3 billions (7,300,000,000)
console.log( 1e-6 ); // Six zeroes to the left from 1, which is 0.000001

console.log( 0xff ); // 255
console.log( 0xFF ); // 255 (the same, case doesn't matter)

let a = 0b11111111; // binary form of 255
let b = 0o377; // octal form of 255

let num = 255;
// The base can vary from 2 to 36. By default it’s 10.
console.log(num.toString(16));  // ff
console.log(num.toString(2));   // 11111111
// If we want to call a method directly on a number, then we need to place two dots .. after it.
console.log(123456..toString(36)); // 2n9c

parseInt and parseFloat

parseInt('100px'); // 100
parseFloat('12.5em'); // 12.5

parseInt('12.3'); // 12, only the integer part is returned
parseFloat('12.3.4'); // 12.3, the second point stops the reading

parseInt('a123'); // NaN, the first symbol stops the process

parseInt('0xff', 16); // 255
parseInt('ff', 16); // 255, without 0x also works

parseInt('2n9c', 36); // 123456

Math Functions