我得到的areas是字符串,然后我把他們放到數(shù)組里面,最后進(jìn)行去重操作,得出的結(jié)果不對(duì),請(qǐng)問怎么修改代碼可去進(jìn)行去重得到[4662,4663]areas += choiceID[0].areas[i].id + ',';console.log('areas is:', areas) // areas is: 4662,4663,4662,4663,var arrAreas = []arrAreas.push(areas)console.log(arrAreas) // ["4662,4663,4662,4663,"]var newAreas = [...new Set(arrAreas)]console.log(newAreas) // ["4662,4663,4662,4663,"]
字符串放到數(shù)組里面進(jìn)行去重操作
白衣染霜花
2018-07-11 23:22:07