💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、豆包、星火、月之暗面及文生图、文生视频 广告
### 1. for循环 ~~~ for(let i=0;i<arr.length;i++){ console.log(arr[i]) ~~~ ### 2. for in (在vue中可以遍历对象) ~~~ for(let k in arr){ console.log(arr[k]); } ~~~ ### 3. for of ~~~ for(let k of arr){ console.log(k); ~~~ ### 4. forEach() ~~~ arr.forEach((v,k)=>{ console.log(v); console.log(k); }) ~~~ ### 5. map((value,index) ~~~ <script> var arr = [1,2,3,4]; // Array.from(arr,(value,index)=>{ // console.log(index); // }); arr.map((value,index)=>{ console.log(index) }) </script> ~~~ ### 6. ~~~ ~~~