我有:
mncs: [ [ 0 ], [ 3 ], [ 5 ], [ 90 ] ],
upMncs: [ [ 0 ], [ 3 ], [ 90 ] ],
criteria.mncs
criteria.upMncs

我需要 addMncs:[[5]],来从第一个数组中剪切相同的元素并获得不同的颜色 我用lodash 请帮忙
答案 0 :(得分:1)
您可以在difference
之后使用flatten
:
var criteria = {
mncs: [ [ 0 ], [ 3 ], [ 5 ], [ 90 ] ],
upMncs: [ [ 0 ], [ 3 ], [ 90 ] ],
}
console.log(_.difference(_.flatten(criteria.mncs), _.flatten(criteria.upMncs)))
// [5]