The contents of the fifth day of school

05.31
a, determining
a triplet of expressions
cycle
determination: if a determination is most
1.If (condition) {
if statement is executed after the condition is satisfied
}
2.
if (condition) {

} {the else
condition is not satisfied when the above when left under
}
3. multiple condition determination
if (condition) {

} the else if (condition) {

} the else if (condition) {

} the else {

}

a set of if determined, if only one, there may be 0 ELSEIF or more
else only 0 or 1
var A = to true;
IF (A) {// this last condition will all be converted to Boolean
the console.log ( "Hello");
} else {
the console.log ( "World");
}

a set of determining if, after the surface of the current condition is satisfied, to perform the latter will not


Second, determine whether the number
isNaN (), if a number, it returns false, not return to true
var In Flag = isNaN (Score);


Three, if judgment
1. NAN when compared with the
2. 0 is converted into digital type false. Nonzero converted into true
math
false converted into 0
true convert to 1.
0 converted to false, non-zero transformed into true What does it mean?
3. the empty string is converted into false, true non-idle replaced
4. type of reference in its entirety converted to true
condition if the judge 5. Do not write the decimal subtraction (key key)
in the determination if
0, false, empty string, undefined, null converted all converted into other false to true.
typeof () method of detection data type, to be detected on the type of the parameter
values returned: string number function object undefind boolean

Fourth, the triplet of expressions to
the ternary operator: simple point to understand is that if a simplified version of
the syntax
expression a group of Formula 2:? Expression 3;
condition (boolean)
to true expression when walking 2
false when walking Expression 3
var = 100 A;
A == 100 console.log ( "hello"):? console.log ( "bad");
five, for circulation
console output
console.log ();
alert box output
alert ()
page output
document.write (); // write the piece of content in the document, the format of the content is a string
document.write ( "hello");
may also output some html code, this code can be parsed html browser
document. write ( '<h1 class = " color_red"> aksjdfhlsjkdf </ h1>');
nested quotes issue
cycle: repeated to execute a section of code within the conditions
for, for in, the foreach, forof, the while, DoWhile
for (condition 1; condition 2; 3 condition) {
loop statements
}
a ++
a = a 1 +
for (var a = 0; a <5; a ++) {// ++ themselves increase. 1
the console.log ( "Hello")
}
1. A var = 0; <B> satisfies <5 </ b>; a + 1--> execution cycle statements inside
2. a = 1; satisfy <5; a + 1 -> execution cycle statements inside
3. a = 2; satisfy <5; a + 1 -> inside the execution cycle statement
4. a = 3; satisfy <5; a + 1 -> execution cycle statements inside
5. a = 4; satisfy <5; a + 1 -> execution cycle statements inside
6. a = 5; not meet <5 cycle has ended

Six out of the loop
break; exit the loop
continue; this cycle out
for (var I = 0; I <10; I ++) {
the console.log (I);
IF (I ==. 5) {// when the condition is satisfied when .
break; // just met, the end of the cycle directly

}
}


Seven function
Function: the package code, the code is a set of
function names: naming rules naming rules and variables as
parameters: the parameter (formal parameters), the type parameter may be limited, the number may not be limited
function body : when the code when the function is executed by calling the
return: return value, if not written, undefined is returned
function function name (parameter 1, parameter 2 ...) {
function body
return function return value
}
function Fun () {
to true return
}
console.log (Fun ()) // execution is a function of the output of the output function return values
console nothing? because the function has not yet begun to call

the function how to call?
console.log (Fun) Fun says that a function
() function to perform symbolic execution is the

built-in function
isNaN () returns a boolean
typeof ()
parseInt ()
parseFloat ()
Alert ()
eval ()
...

Guess you like

Origin www.cnblogs.com/cnblogso/p/10955925.html