Correction status:qualified
Teacher's comments:作业的标题不符合、缺少总结,群文件中有作业的要求请详细阅读一下
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>1.16</title> </head> <body> <p onclick="alert('不错100分')">我爱玩js</p> <button onclick="dj()">点击</button> <button onclick="kaoshi()">考试</button> </body> <script> function dj(){ var i=6; if(i<5){ alert('数字太小了') }else{ alert('刚刚好') } } </script> <script src="static/js/js01.js"></script> <script> function kaoshi(){ var grade = 100; // 这里必须传入true,否则内部除了default外,不会执行任何分支 // 这种情形适用于case 条件是一个条件表达式,而不是一个离散的具体值 switch (true) { case (grade >= 60 && grade < 80): console.log('合格'); break; case (grade >= 80 && grade < 90): console.log('良好'); break; case (grade >= 90): console.log('优秀'); break; default: console.log('补考'); } } var i = 0; while (i<10) { console.log(i); i++; // 必须要设置循环终止的条件,否则会陷入死循环 } var cars=["baoma","luhu","benchi"]; for(i=0;i<cars.length;i++) { document.write(cars[i]+"<br>") } </script> <script type="text/javascript"> var arr = new Array(6)//slice的用法 arr[0] = "George" arr[1] = "John" arr[2] = "Thomas" arr[3] = "James" arr[4] = "Adrew" arr[5] = "Martin" document.write(arr + "<br />") document.write(arr.slice(2,4) + "<br />") document.write(arr) </script> <script> </script> </html>
点击 "运行实例" 按钮查看在线实例