Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Look up arrow functions for javascript...Shorthand method for creating functions.
Perfect! Thanks much. Even if it doesn't work for all cases I was more curious about the code itself regardless of wether it passes the test cases. That helps a lot.
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.
If you have time could you explain what's heppening here. I'm still having problems understanding how these filters work. I understand the concept but your code has me confused.
Thanks!