二维数组转一维数组、对象数组互斥去重

二维数组转一维数组:

//二维数组转一维数组
function flatten(arr) { return [].concat(...arr.map(x => Array.isArray(x) ? flatten(x) : x)) }

对象数组互斥去重:

//对象数组互斥去重
function getArrDifference(arr1, arr2) {
    for (let i in this.arr1) {
        for (let k in this.arr2) {
            if (this.arr1[i].perName == this.arr2[k].perName) {
                this.arr2.splice(k, 1)
            }
        }
    }
}
原文地址:https://www.cnblogs.com/foxcharon/p/15175917.html