isRepeat() function isRepeat() { var $array = [0, 0, 0, 0, 0, 0, 0, 1] console.log($array.length) for (i = 0; i < $array.length; i++) { if ($array[i] > 0) { console.log($array) } else { $array.splice(0, 1) console.log($array) console.log($array.length) } } } 為什么數組length變4后就不動了啊?我想去下前面沒用的0比如0000000001,000000002,最后只剩下有效數字!
js數組去重復
桃花長相依
2018-09-03 12:31:04