JS- 使用forEach

       

         // 使用forEach

        let arr1= [2, "w", 3];

        arr1.forEach(function(item){

            console.log("item=" + item);

        }); 

        arr1.forEach(function(item,index){

            console.log("arr["+index+"]=" + item);

        });

发布了28 篇原创文章 · 获赞 0 · 访问量 150

猜你喜欢

转载自blog.csdn.net/weixin_41813243/article/details/105398496