我得到的areas是字符串,然后我把他们放到数组里面,最后进行去重操作,得出的结果不对,请问怎么修改代码可去进行去重得到[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,"]
侃侃无极
慕田峪7331174