Find the highest integer in the array using recursion
Create a function that finds the highest integer in the array using recursion.
Examples:
findHighest([-1, 3, 5, 6, 99, 12, 2]) ➞ 99 findHighest([0, 12, 4, 87]) ➞ 87 findHighest([6,7,8]) ➞ 8
const findHighest = (arr) => { if(arr.length === 1) { return arr[0]; } let max = findHighest(arr.slice(1)); return arr[0] > max ? arr[0] : max; } console.log(findHighest([-1, 3, 5, 6, 99, 12, 2])); // 99