Get the App
SLTechnology News&Howtos  ›  Development  › 

Case Analysis of JavaScript numerical number

Shulou Source: shulou.com Published: 2022-06-01 10:53:57 09月28日 Update

This article mainly introduces "JavaScript numerical number case analysis". In daily operation, I believe many people have doubts about JavaScript numerical number case analysis. The editor consulted all kinds of data and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts of "JavaScript numerical number case analysis"! Next, please follow the editor to study!

JavaScript has only one numeric type. Numbers can be decimal or not.

Var num1=5.02; / / write with decimal point

Var num2=520; / / write without using decimal point

/ / very large or very small numbers can be written by scientific (exponential) counting

Var yearly 123e5; / / 12300000

Var zhuang 123eMui 5; / / 0.00123

Range of values:

5e324 ~ 1.7976931348623157e+308

If it is out of range, it will be expressed as Infinity or-Infinity

Special numerical value NaN:

NaN is of type number and is a numeric value

Characteristic 1:NaN performs any operation with any number and the result is NaN

Characteristic 2:NaN is not equal to any number, including oneself

Related functions:

IsNaN () determines whether the data is NaN and returns true, otherwise it returns false

IsFinite () determines whether the data is within the range and returns true within the range, otherwise false

/ / NaN is a special number that is not equal to all other values, including itself

Console.log (NaN = = NaN); / / false

/ / the only way to identify NaN

Console.log (isNaN (NaN)); / / true

/ / range: 5e324 ~ 1.7976931348623157e+308

Var min = 5e324

Var max = 1.7976931348623157e+308

Var a = 1.7976931348623157e+309

Console.log (min); / / Infinity

Console.log (max); / / 1.7976931348623157e+308

Console.log (a); / / Infinity

Console.log (isFinite (a)); / / false (out of range, out of range)

At this point, the study of "JavaScript numerical number example Analysis" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Values ranges examples case analysis analysis learning decimals decimal points numbers special data methods more features types help practical minimal next function Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Apple vpn Huawei Docker