Ad
  • Custom User Avatar

    Sure,

    Filter iterates over each value (v) and creates a new Array containing only the values that when passed into the supplied function return true.

    The function I've used returns Array.includes which tests whether the value is present in an array and returns true or false.

    What might seem confusing is the ! operator which negates a value (turns true to false and false to true).

    So I've basically written: arr1 filter the values that are NOT included in arr2.

    I've used the same on arr2 and then joined them together using concat.

    Hope that makes some sense.

    tbh. I'm not even sure this is a valid solution. It doesn't work in some cases, even though it passes all the current tests.