1, Javascript only has one type of numberic data, named "Number". You can see this reflected in the behavior of the typeof operator, which classifies Intergers and Floati Ng-point numbers alike simply as numbers:
typeof ; "Number"typeof 10.3; "Number"typeof -1.5; "Number"
2, in fact, all numbers be double-precision floating-point numbers, known as "doubles", which is 64-bit encolding of num Bers, keep in mind, the doubles can represent intergers perfectly with up to $ bits of precison. All of the integers from-253 to 253 is valid doubles.
3, Note that floating-point numbers is inaccurate when on arithmetic, for example, 0.1+0.2 = 0.30000000000004;
It is better to tranform the floating-point number to intergers for calculation. Ten + 30;
--------------------------------------------------------------------------------------------------------------- --------------------
4, coercisons can also hide errors (implicit type conversion may hide errors).
An undefined variable would convert to the NaN in an arithmetic calculation, which causes the calculation OT cont Inue with often confusing and unprdictable results.
JS Basic 1: Understanding the Number data type and implicit type conversions