JavaScript Authority Guide Reading notes
The lexical structure of the first chapter
JavaScript is case-sensitive, while HTML is case-insensitive
The Unicode escape sequence is composed of/u as a prefix plus a 4-bit 16-digit number
Identifiers must begin with letters, underscores _, dollar characters $,
Semicolon: In JavaScript, a statement is exclusive, and you can usually omit the semicolon between statements.
Exception:
1 return,break,continue, followed by a newline, JavaScript will fill in line at the semicolon.
2. Binocular operator ++,--, if you want to be an expression suffix, you must be the same line as an expression.
chapter II types, values and variables
JavaScript supports decimal and hexadecimal, because the ECMAScript standard does not support octal direct, so it is best not to use 0 as a prefix of the direct amount
Properties of the Math object:
Math.Round (. 6) //=>1.0 rounded
math.ceil (. 6) //=>1.0 to go up
Math.floor (. 6) //=>0.0 go down the whole
Special case overflow in arithmetic operations (overflow): The result of a numeric operation exceeds the upper limit that JavaScript can represent
Positive numbers return Infinity, negative returns-infinity underflow (underflow): The result is smaller than the smallest number that JavaScript can represent, and returns 0,
Negative Underflow returns a special value of '-0 '
By 0 The whole out returns Infinity or-infinity, with the exception that 0/0 returns Nan
NaN: is not equal to any value, including itself
To judge the isNaN () function
x!=x; True only if X is Nan
0 and -0 values are equal except for the two values of the divisor.
Binary floating-point numbers do not accurately represent a simple number similar to 0.1
(. 2-.1) = = (. 3-.2); =>>false
String Direct: When you use single quotes to define a string, you need to be careful of all and abbreviations in English, with (/) escaping
JavaScript and HTML band? Use separate quote styles
JavaScript expressions use single quotes to represent strings
HTML event-handling properties are represented by double quotes in a string
Property:
S.replace ("H", "H"); "Hello" => "Hello"
s.touppercase ();//"Hello" => "Hello"
The string can also be used as a reading group, accessed by square brackets
Boolean value: Any value of JavaScript can be converted to a Boolean value
false:undefined; null; 0; -0; NaN; ' '
True: All other values, including all objects, array
Null is the key word for JavaScript, undefined is a predefined global variable, and "= =" thinks the two are equal
Wrapping Objects
var s= "test";
s.len=4;
Var T=s.len; Undefined
Behaves like an object when reading the properties (or methods) of strings, numbers, and Boolean values. But attempting to assign a value to its property ignores the action: the modification only occurs on the temporary object, and the temporary object is not persisted
The original value cannot be changed. (Undefined,null, Boolean, numeric, String)
Object can be changed by object property (array, function) two objects contain the same properties and values and are not equal
Number () and parsefloat () difference
Number (): Can only be used for decimal conversion, and no illegal trailing characters can appear
parseint (): Skips any number of leading spaces and ignores subsequent content, the first non-whitespace character is illegal, and the numeric direct quantity returns Nan
All objects converted to Boolean values are true
Although a global scope can write code without writing a var statement, you must use the VAR statement when declaring a local variable
Declaration advance: The function body local variables cover the same name global variables, the function body of the variable declaration will advance to the top of the function body
When you declare a JavaScript global variable, you are actually defining a property of the global object
In JavaScript, all columns are floating-point types, and the division result is also a floating-point third chapter
"= =": When both operand types and values are equal. 0===-0
' = = ': If two operands are not of the same type, an attempt is made to type conversions
The plus operator prefers strings; comparison operators prefer numbers, and only two numbers are string comparisons, and if one operand is Nan, the total returns false
In most cases a op= B is equivalent to A = a op b; It is not equivalent when a contains an expression with side effects, eg:data[i++]*=2; data[i++]=data[i++]*2;
typeof (NaN) = = "Number";
Delete can only delete object attributes or array elements, unlike the operand in C + + that deletes the entire object delete is not a left value, returns true without an operation, and returns true if the deletion succeeds