-3
mncs: [ [ 0 ], [ 3 ], [ 5 ], [ 90 ] ],
upMncs: [ [ 0 ], [ 3 ], [ 90 ] ],
criteria.mncs
criteria.upMncs
我需要得到addMncs:[[5]],削減從第一陣列相同的元素,不像
我用lodash 幫助獲取請
mncs: [ [ 0 ], [ 3 ], [ 5 ], [ 90 ] ],
upMncs: [ [ 0 ], [ 3 ], [ 90 ] ],
criteria.mncs
criteria.upMncs
我需要得到addMncs:[[5]],削減從第一陣列相同的元素,不像
我用lodash 幫助獲取請
您可以在flatten
之後使用difference
:
var criteria = {
mncs: [ [ 0 ], [ 3 ], [ 5 ], [ 90 ] ],
upMncs: [ [ 0 ], [ 3 ], [ 90 ] ],
}
console.log(_.difference(_.flatten(criteria.mncs), _.flatten(criteria.upMncs)))
// [5]
我知道_.flatten,是的,它很聰明)謝謝 – AxOn
你有什麼代碼? –