首页 > 代码库 > 【JS】Array

【JS】Array

var arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]for (var i = 0, l = arr1.length; i < l; i++) {    arr1.splice(i, 1)}var arr2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]for (var i = arr2.length; i >= 0; i--) {    arr2.splice(i, 1)}console.log(arr1, arr2) //  [2, 4, 6, 8, 0] []

 

【JS】Array