- An absolute value less than or equal to 2 of the 53-square integer, that is-253 to 253, can be precisely represented, that is, the 15-bit decimal number can be accurately processed ;
- JavaScript can represent a range of values from 21024 to 2-1023 (open interval), the number beyond this range cannot be expressed;
NaNis not a separate data type, but a special value, its data type still belongs Number ;
NaNNot equal to any value, including itself;
- Simple mathematical operations are hardly likely to throw errors;
InfinityWith NaN comparison, always returns false;
- 0 times
Infinity , returns NaN ;
- 0 divided
Infinity by, return 0;
InfinityDivide by 0, return Infinity ;
parseFloatMethod will automatically filter the leading spaces of the string;
parseFloatThe empty string will be converted to NaN ;
- A value of true, which is
isNaN probably not NaN , but a string;
- Returns true for objects and arrays
isNaN ;
- However, for an empty array and an array with only one numeric member,
isNaN false is returned.
A NaN more reliable method of judging is to use this characteristic, which is not equal to the NaN value of itself, to judge:
function myIsNaN(value) { return value !== value;}
- Except
Infinity ,, -Infinity , NaN and undefined these values will return false, and the isFinite method will return true for the other values;
- A single character inside a string cannot be changed or deleted, and these operations silently fail;
- The length property of the string cannot be changed, but will not error;
- The unit character length of JavaScript is fixed at 16-bit length, which is 2 bytes. For characters between u+10000 and U+10FFFF, JavaScript always considers them to be two characters (the length property is 2). So when dealing with this, you must take this into account, thatis, the length of the string returned by JavaScript may be incorrect;
- Properties can be created dynamically without having to be specified when the object is declared;
- If different variable names point to the same object, then they are all references to the object, that is, to the same memory address. Modifying one of the variables will affect all other variables;
JAVASCRIPT specifies that if the beginning of the line is curly braces, it is interpreted as a statement (that is, a code block). If you want to interpret as an expression (that is, an object), you must precede the curly braces with parentheses:
eval(‘{foo: 123}’) // 123eval(‘({foo: 123})’) // {foo: 123}
Note that if you use the square bracket operator, the key name must be enclosed in quotation marks, otherwise it will be treated as a variable:
var foo = ‘bar’;var obj = { foo: 1, bar: 2};obj.foo // 1obj[foo] // 2
- Note that the numeric key name cannot use the dot operator (because it is treated as a decimal point), only the square bracket operator is used:
var obj = { 123: ‘hello world’};obj.123 // 报错obj[123] // “hello world”
- To view all the properties of an object itself, you can use the Object.keys method:
var obj = { key1: 1, key2: 2};Object.keys(obj);// [‘key1’, ‘key2’]
- The delete command can only delete properties of the object itself and cannot delete inherited properties;
- One problem with the in operator is that it does not recognize which properties are the object itself and which are inherited:
var obj = { p: 1 };‘p’ in obj // true‘toString’ in obj // true
JavaScript Basic Learning Experience 01