1 <!DOCTYPE html> 2 <html> 3 <head lang="en"> 4 <meta charset="UTF-8"> 5 <title></title> 6 </head> 7 <body> 8 <script> 9 10 var arr = ["关羽","张飞","赵云","马超","黄忠"]; 11 12 //遍历数组就是循环(获取)数组中的每一项 13 for(var i=0;i<arr.length;i++){ 14 //代表的是数组中的每一个元素; 15 // arr[i] 16 console.log(arr[i]); 17 } 18 19 20 </script> 21 </body> 22 </html>