Three Order of execution:
1, sequential implementation;
2, select the implementation;
3, loop execution.
Conditional statements:
determines whether the specified code is executed or skipped by judging the resulting result.
If statement:
var a = 3;
if (a>5) {
Console.log (a);
}
Attention:
1. The condition result after the IF keyword must be a Boolean value;
2. The parentheses after the IF keyword cannot be omitted;
3, if the curly braces {} After the If can be omitted, but is not recommended to omit.
If else:
Cases:
var b = 5;if (b>10) {Console.log ("B greater than 10"); }else {Console.log ("B less than 10"); }If Else statement nesting:Example:var sum = n;if (sum>90) {Console.log ("excellent"); }else {//<=90if (sum>=60) {console.log ("Liang"); }else{Console.log ("poor"); } }else if:Example:var sum = 98;if (sum>90) {Console.log ("excellent"); }else if (sum>60 && sum<90) {console.log ("Liang"); }else {Console.log ("poor"); }Swich Case StatementExample:var a = 4;switch (a) {Case 1:Console.log ("111");Break ;Case 2:Console.log ("222");Break ;Case 3:Console.log ("333");Break ;default://When the value is not declared, the default is executedConsole.log ("4444"); }
JavaScript Process Control Statements