recurse js code example
Example: javascript recursion over array
function recurse(arr=[])
{
// base case, to break the recursion when the array is empty
if (arr.length === 0) {
return;
}
// destructure the array
const [x, ...y] = arr;
// Do something to x
return recurse(y);
}