How to use the number type in Typescript
This article mainly shows you how to use the number type in Typescript. The content is simple and easy to understand and the organization is clear. I hope it can help you solve your doubts. Let Xiaobian lead you to study and learn the article "How to use the number type in Typescript".
number
Numeric types, like javascript, typescript's numeric types are floating point numbers and can support binary, octal, decimal and hexadecimal.
let num:number = 123;num = '456'; //error num = 456; //correct
Base notation:
let decLiteral:number = 6;//decimal let hexLiteral:number = 0xfood; //hexadecimal let binaryLiteral:number = 0b1010; //binary let octalLiteral:number = 0o744; //octal above is "Typescript number type how to use" All the content of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!