JavaScript can both save integer numeric types, you can also save a decimal (floating point).
var age = 21; // 整数
var Age = 21.3747; // 小数
Numeric hexadecimal
The most common band have binary, octal, decimal, hexadecimal.
// 1.八进制数字序列范围:0~7 var num1 = 07; // 对应十进制的7 var num2 = 019; // 对应十进制的19 var num3 = 08; // 对应十进制的8 // 2.十六进制数字序列范围:0~9以及A~F var num = 0xA;
At present, we only need to remember that in JS octal preceded by 0, hexadecimal preceded by 0x
Numeric range
The maximum and minimum values in JavaScript
Maximum: Number.MAX_VALUE, this value: 1.7976931348623157e + 308
Minimum: Number.MIN_VALUE, this value: 5e-32
Three special numeric value
Infinity, represents the infinite, greater than any value
-Infinity, on behalf of the infinitesimal, less than any value
NaN, Not a number, representing a non-numeric
isNaN
It used to determine whether a variable is non-numeric type, returns true or false
js var usrAge = 21; var isOk = isNaN(userAge); console.log(isNum); // false ,21 不是一个非数字 var usrName = "andy"; console.log(isNaN(userName));// true ,"andy"是一个非数字