【发布时间】:2021-03-18 16:58:07
【问题描述】:
我已经对此进行了搜索,但解决方案希望您知道要合并多少个数组而不重复。
我必须循环一个包含任意数量数组的对象。
数组中的对象类型为{sType: string, nLaId: number, sname: string}
要确定一个对象是否重复,必须检查是否有另一个对象具有相同的sType AND nLaId。
for(let key in objectContainingArrays){ // objectContainingArrays[key] is an array with specific objects of type {sType: string, nLaId: number, sname: string}
// how would I merge the arrays here in the fastest way without duplicates?
}
如果解决方案很明显或者可以在另一个问题中找到解决方案,那么我很抱歉,我会很感激一个链接。谢谢!
【问题讨论】:
标签: javascript arrays typescript merge duplicates