What will be the output of the following recursive function?
function findMax(arr) {
if (arr.length === 1) {
return arr[0];
}
let subMax = findMax(arr.slice(1));
return arr[0] > subMax ? arr[0] : subMax;
}
console.log(findMax([3, 6, 2, 8, 1]));