Simple types / Numbers / Integer

//decimal number system
let decimal = 42

//octal number system
let octal = 0o42
//octal is 34

//hexadecimal number system
let hex = 0x42
//hexadecimal is 66

//binary number system
let binary = 0b1010
//binary is 10

//42 to decimal string
let sDecimal = decimal.toString()
//sDecimal is "42"

//42 to octal string
let sOctal = decimal.toString(8)
//sOctal is "52"

//42 to hexadecimal string
let sHex = decimal.toString(16)
//sHexadecimal is "2a"

//42 to binary string
let sBinary = decimal.toString(2)
//sBinary is "101010"

console.log("octal =", octal)
console.log("hexadecimal =", hex)
console.log("binary =", binary)
console.log("sDecimal =", sDecimal)
console.log("sOctal =", sOctal)
console.log("sHexadecimal =", sHex)
console.log("sBinary =", sBinary)