Number
Represents numeric values, including integers and floats.
The number type in TypeScript is used for all numeric values. This includes integers, floating-point numbers, and special values like Infinity, -Infinity, and NaN.
Example of usage
let age: number = 30;
let price: number = 19.99;
let hexValue: number = 0xf00d;
Notes
- All numbers in TypeScript are floating-point values.
- TypeScript also supports binary, octal, hexadecimal, and decimal literals.