javaScript里的arr.foreach()用法

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script>
      var arr=[12,13,15];
    //             当前值  下标   所在数组
       arr.forEach((value,index,arrs)=>{
           console.log(index+">>>>>>>"+value+"  "+arrs);
       })
    </script>
  </head>
  <body>
  </body>
</html>
posted @ 2020-04-22 19:57  玄空2  阅读(2235)  评论(0编辑  收藏  举报