The number data type holds floating-point values. Similar to JavaScript, TypeScript considers all numbers as floating-point values. Declaring and initializing the number data type variable can be done as follows:
let price: number = 101;
Here, the price variable is declared as number and is assigned the value 101. Number type can hold values such as decimal, binary, hexadecimal, and octal literals, as shown:
let decimal: number = 6;
let hex: number = 0xf00d;
let binary: number = 0b1010;
let octal: number = 0o744;