Hey people,
I really like FP. After completing OOP which seemed like a big mess to me, FP is like a wave of fresh water. I love the concept, I love the straightforwardness of it but I am also aware that I know very little about it yet.
I’ve had this challenge in front of my eyes for a few minutes and started to think it out in chunks (algorithm after all, huh?) and to my great surprise the solution came out pretty easy and it worked. I then looked at various solutions on this forum and in the guide and got some seconds thoughts, My main concern is how re-usable is this? Does spread operator and filter function do the right job?
function destroyer(arr) {
// Remove all the values
return arr.filter(x => !([...arguments].includes(x)));
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);