In JavaScript, a number is represented in 64-bit format, so there are exactly 64 bits to store a number. 
  • 52 bits are used to store the digit
  • 11 bits store the position of the decimal point 
  • 1 bit indicates the sign
How to write numbers
  • We could write
let billion = 1000000000;
let fourThousand = 4000;
let ms = 0.000001
  • If we are lazy, we could also write
let billion = 1e9;
let fourThousand = 4e3;
let ms = 1e-6;
In short, e multiplies the number by 1 with the given zeroes count.

Hex, binary and octal
let hex = 0xff; // 255 
let bin = 0b1101; // 13
let oct = 0o35; // 29

How to convert a number to a string
  • Use the unary + operator. However, if the provided string is not exactly a number, it fails: 
let thousand = "1000";
let numThousand = +thousand;
console.log(typeof thousand); // string
console.log(typeof numThousand); // number
console.log(+"100px"); // NaN
  • If you are not sure of the string input, use parseInt() or parseFloat()
let numPix = "100px";
console.log(parseInt(numPix)); // 100
let amount = "100$";
console.log(parseInt(amount)); // 100
console.log(parseInt("$100")); // NaN, the first symbol stops the process