Javascript从另一个数组中存在的数组中删除项目,而不对mutrs进行变更

时间:2017-04-06 18:52:33

标签: javascript redux

我有两个数组

["bye", "good morning"];

如何从数组a中删除数组b中存在的项目(没有变异)?结果数组应如下所示: -

                     Microservices Sample Architecture

1 个答案:

答案 0 :(得分:3)

filter()和some()

let a = ["Hello", "bye", "good morning", "test"],
    b = ["Hello", "test"],
    c = a.filter( e => !b.some( i => i===e))