<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <script> // 哪些数据是假 // 0 undefined null "" NaN false // if ( [] ){ // alert('真,执行'); // } // if ( 2<6 ){ // alert(1); // //真,执行的语句 // } else{ // alert(2); // // 假执行的语句 // }; let a = 40; if ( a>50 ){ alert(1) } else if ( a>40 ){ alert(2) } else if ( a>30 ){ alert(3) } else if ( a>20 ){ alert( 4 ) //不会执行 } </script> </body> </html>