-3

How remove elements of array from another array? I have first array ["a" "b" "c"]. And second array [["a", "e"], ["e", "b", "c"], ["a","c"]].

How remove elements of first array from second array?

as a result, get [["e"], ["e"], []].

Darkin Rall
  • 133
  • 10

1 Answers1

0

const first = [
  ["a", "e"],
  ["e", "b", "c"],
  ["a", "c"]
]
const second = ["a", "b", "c"]

const result = first.map(el => {
  return el.filter(elem => !second.includes(elem))
})

console.log(result)
Vahe Yavrumian
  • 425
  • 7
  • 18