标签:lang length javascrip java filter console 数组 class for
let arr1 = [1,2,3,4,5,6]
let arr2 = [‘1a‘,‘2a‘,‘3b‘,1]
let arr3 = [];
for(let i in arr1.length > arr2.length ? arr1 : arr2){
if (arr1[i]) arr3[2*i] = arr1[i]
if (arr2[i]) arr3[2*i+1] = arr2[i]
}
let arr4 = arr3.filter(e=>e)
console.log(arr4);
标签:lang length javascrip java filter console 数组 class for
原文地址:https://www.cnblogs.com/China-Dream/p/14430387.html