Js authoritative guide --- Study Notes 01, js --- Study Notes 01
1. When a function is assigned an attribute to an object, it is changed to a method;
2. If division by Zero is not reported, only Infinity or negative Infinity is returned. Exception: dividing by zero equals to non-Numeric (NaN ).
3. NaN is not equal to any value!
4. Javascript uses a binary floating point representation (IEEE-754), which will lead to the inability to accurately represent simple decimal places like 0.1;
It can only represent any combination of sums of 1/(2 ^ N.
5. boolean values: true and false values;
False: false, null, 0,-0, "" (empty string), NaN, undefined
True Value: All values except the dummy value!
6. Original values: undefined, null, number, string, and Boolean.
-- Unchangeable
7. Any value except null and undefined has the toString () method;
It can be converted to a String using the String () method: String (undefined) // => undefined
8. Value of the number type. When toString () is called, you can specify a parameter to indicate the Conversion Type: 2, 8, 16;
Var n = 1;
Var s2 = n. toString (2 );
Var s8 = "0" + n. toString (8 );
Var s16 = "0x" + n. toString (16 );
9. toFixed (number) method: Rounding the form, retaining the number of decimal places;
10. Several Methods for converting strings to numbers: Number (), parseInt ()/parseFloat (), string-0
1) Number () method: If the string is not a Number, NaN is returned.
2) parseInt () and parseFloat () Methods: parses numeric characters in sequence. If a non-character is encountered, resolution is aborted. If the first character of a string is not a number, NaN is returned;
3) parseInt () can accept the second parameter, that is, the hexadecimal conversion (2 ~ 36)