-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"], []].

1
  • 4
    what effort have you made? Commented May 8, 2020 at 19:47

1 Answer 1

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)

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.