uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]);
Can Someone please explain this line of code? " .filter((item, ind, arr) => arr.indexOf(item) === find);" how it is actually working? I can’t understand. Please help.
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36
Challenge: Intermediate Algorithm Scripting - Sorted Union
Thank you for your guidance. So when the filter method is used, there are three variables “item”, “ind” and “arr” inside the parenthesis. I want to figure out what “arr” actually represents . “ind” means the index of the current element being passed. But how are duplicate values omitted when the filter method is used on the […arguments] ?
Please look at the line below for the given solution as mentioned above.