Hi I did the course and I get to Hint section in order to see different approaches.
Solution 4(Recursive) it has its own beauty but I don’t understand this i=0
argument.
function dropElements(arr, func, i = 0) {
return i < arr.length && !func(arr[i])
? (dropElements(arr.slice(i + 1), func, i))
: arr;
}
Instead you can remove it and works perfectly
function dropElements(arr, func) {
return 0 < arr.length && !func(arr[0])
? (dropElements(arr.slice(1), func))
: arr;
}