First, the grammar
Identifier: The first character must be a letter, an underscore, or a cent symbol.
You cannot use keywords, reserved words, true, false, or NULL as identifiers.
Strict mode
"Use Strict"
Ii. keywords and reserved words
Break Delete function return typeof
Case do if switch var
Catch else in this void
Continue false instanceof Throw while
Debugger finally new true with
Default for NULL try
Abstract double goto native static
Boolean Enum implements package Super
Byte Export Import private synchronized
char extends int protected throws
Class final interface public transient
Const float Long Short volatile
Third, variable
Undefined values are saved without initialization
A local variable is defined with Var
Iv. Types of data
typeof returns the data type, UNLL returns an object because UNLL is considered an empty reference.
Undefined
Null is best to initialize the variable that will be used to save the object to null
Boolean
Number octal 0 start hex 0x
Isfinite () function negative infinity number.negative_infinity positive Infinity number.positive_infinity
NaN represents the wrong number and is not equal to itself
IsNaN () Function: Determine if the parameter is not a numeric value
numeric conversion number () ignores string leading 0--"011" → "11" 16 binary converted to decimal floating-point reservation
If it is an object, use ValueOf () first, and if you return Nan, then call ToString ()
parseint () ignores leading spaces, the first one is not a number or minus sign returns Nan, and conforms until it encounters a non-digit or end
ECMAScript5 070 gets 70, plus the second parameter as a cardinality
It stops when you hit a decimal point.
Parsefloat () encountered the first decimal point does not stop
string \ \ \ \ "
\ nthe newline \ t tab \b BACKSPACE \ r return \f Feed
Length Property
The ToString () method can pass the cardinality
The String () method value is null, undefined, returns null, undefined
with + and "" add up can be converted to a string
Object
Five, operator
++ --
+ -
~ Minus 1 for the negative value of the bitwise non-operand
& | ^ Bitwise XOR OR
<< >> Signed
<<< >>> Unsigned
! && | |
* / %
+ If only one operand is a string, the other operand is also converted to a string each addition is executed independently
-
> < >= <= The character number of uppercase letters is smaller than lowercase tolowercase method comparison
The "Total" < "3" string compares the first
= =! = Convert operand First
Null is equal to undefined
If the two operands are objects, then the comparison is not the same object.
= = =! = = Do not convert
? :
=
,
Vi. statements
If
Do While
While
For
The properties of the for in enumeration object
for (var in window) { document.write (propname); document.write ("<br/>"); }
Each loop assigns a property name that exists in the Window object to the PropName, and the order is not predictable
Label label, mate with Loop statement
Break continue
var num = 0; Outermost: For (var i=0; <, i++) {for (var j=0; J < Ten; J + +if (i = = 5 &&A mp j = = 5 break outermost;} num++/ /
With sets the scope of the code to a specific object.
with (location) { var qs = search.substring (1); var hostName = hostName; // unavailable when viewing from a local file var url = href; }
Each variable is considered to be a local variable, and if the definition of the variable is not found in the local environment, the location object is queried for properties with the same name. If a property of the same name is found, the value of the Location object property is used as the value of the variable.
Switch does not take type conversions
Seven, function
Arguments object access parameters can be used with named parameters
Without overloading, which defines two functions with the same name, the name belongs only to the post-defined function.
JavaScript Advanced Programming Notes (III)