Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the number type in Typescript

Shulou Source: shulou.com Published: 2022-06-01 03:25:33 09月22日 Update

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!

Tags: Type content article binary octal hexadecimal decimal decimal learning help numerical numeric easy to understand more organized points knowledge ribbon industry information Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Shulou Technology Apple Linux Redmi