javascript if 与 if else 的一点小认识
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Document</title> 6 </head> 7 <body> 8 <script> 9 var a = 20; 10 if (a>10) { 11 console.log("a>10") 12 } 13 if (a>11) { 14 console.log("a>11") 15 } 16 </script> 17 </body> 18 </html>
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Document</title> 6 </head> 7 <body> 8 <script> 9 var a = 20; 10 if (a>10) { 11 console.log("a>10") 12 }else if (a>11) { 13 console.log("a>11") 14 } 15 </script> 16 </body> 17 </html>
坚持下去就能成功