- if (condition) {} block
- } else {code block
- Process execution: {If the code execution condition is satisfied if the condition is not satisfied} {} later execute the code
- and if the opposite conditions else, even if the conditions are met else will perform a one at a time
- Only execute if either executed or else a
- where N1 = 20;
- where n 2 = 30; if(n1
- if (condition) {} block
- } else {code block
- Process execution: {If the code execution condition is satisfied if the condition is not satisfied} {} later execute the code
- and if the opposite conditions else, even if the conditions are met else will perform a one at a time
- Only execute if either executed or else a
- where N1 = 20;
- where n 2 = 30; if(n1
- Else if without a separate var isEated = true
- A plurality of conditions is determined if .. else if ... else if..else, if ... if ... if (not recommended) var age = 3;
- if..if as long as the condition is true if all will be executed if(age<7){
- if nested
- 65-year-old male retirement age retirement age of 60 years old girl var sex = "female" // age1 = 63 on behalf of gender var; // represents the age of f (sex == "M") {
- Else if without a separate var isEated = true
- A plurality of conditions is determined if .. else if ... else if..else, if ... if ... if (not recommended) var age = 3;
- if..if as long as the condition is true if all will be executed if(age<7){
- if nested
- 65-year-old male retirement age retirement age of 60 years old girl var sex = "female" // age1 = 63 on behalf of gender var; // represents the age of f (sex == "M") {
} the else {
console.log ( "My age is:" + n2 + "years old");
}
} the else {
console.log ( "My age is:" + n2 + "years old");
}
if(isEated){
console.log("吃了啥");
}
if(age<1){
}else if(age>7){
console.log("儿童");
}else if(age<15){
console.log("少年");
}else{
console.log("花甲");< br> }
console.log("儿童");
}
if(age<15){
console.log("少年");
}
IF (AGE1> = 65) {
}
}
IF (Sex == "M") {
IF (age1> = 65) {// determine the age is not greater than or equal 65
console.log ( "I am a man finally retired");
} the else {
console.log ( "the teenager woke up have to continue to work");
}
} the else {
IF (AGE1> = 60) {
console.log ( "I am a woman ha ha I'm retired");
}
}
if(isEated){
console.log("吃了啥");
}
if(age<1){
}else if(age>7){
console.log("儿童");
}else if(age<15){
console.log("少年");
}else{
console.log("花甲");< br> }
console.log("儿童");
}
if(age<15){
console.log("少年");
}
IF (AGE1> = 65) {
}
}
IF (Sex == "M") {
IF (age1> = 65) {// determine the age is not greater than or equal 65
console.log ( "I am a man finally retired");
} the else {
console.log ( "the teenager woke up have to continue to work");
}
} the else {
IF (AGE1> = 60) {
console.log ( "I am a woman ha ha I'm retired");
}
}