I think many of JSthe JavaScript instructions are not well thought out for functional programming. Splice returns the deleted element where most of the time you need the reduced array. This is bad.
Imagine you are doing a recursive call and hashave to pass an array with one less item, probably without the current indexed item. Or imagine you are doing another recursive call and has to pass an array with an element pushed.
In netiherneither of these cases you can do myRecursiveFunction(myArr.push(c)) or myRecursiveFunction(myArr.splice(i,1)). The first idiot will infactin fact pass the length of the array and the second idiot will pass the deleted element as a parameter.
So what iI do in fact... For deleting an array element and passing the resulting to a function as a parameter at the same time iI do as follows
myRecursiveFunction(myArr.slice(0,i).concat(a.slice(i+1))) When it comes to push that's more silly... I do like,
myRecursiveFunction((myArr.push(c),myArr)) I believe in a proper functional language a method mutating the object it's called upon must return a reference to the very object as a result.