<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> //js中有两种for循环 //第一种循环的是下标和key <script> var a=[11,22,33,44] for (var item in a){ //循环的是a的索引 console.log(a[item]) } //循环字典操作 var b={"k1":"v1","k2":"v2",} for (var item in b){ console.log(b[item]) } </script> //for循环产生下标 不支持字典操作 <script> var a=[11,22,33,44] for (var i =0;i<a.length;i++){ console.log(a[i]) } </script> </body> </html>