有如下代碼:var arr1 = [1,2,3,4,5,6,7,8,9,10,11,12];var arr2 = [{ count:3,
month:5,
},
{ count:6,
month:7
}];
現(xiàn)在需要合成另外一個(gè)數(shù)組:var result = [null,null,null,null,null,3,null,6,null,null,null,null];即:所求數(shù)組有數(shù)據(jù)(3,5)的為arr2中的count的值,所在的下標(biāo)為arr2中的month的值,其他置空,數(shù)組長(zhǎng)度為arr1的長(zhǎng)度,請(qǐng)問應(yīng)該怎么做?新手求大神指點(diǎn)
JavaScript數(shù)組的拼湊問題
函數(shù)式編程
2018-09-07 14:12:10