#js过滤数组中出现的null let arr = [1,2,3,null,5] let arr1 = arr.filter(n => n) console.log(arr1) arr1[1,2,3,,5]