Hi,

After doing a recursive challenge on edabit, I saw the working solution below and can’t seem to understand why it works.

The challenge was to Create a function that finds the highest integer in the array using recursion.

```
function findHighest(arr){
if (arr.length==1)
{
return arr[0];
}
else
{
var res = findHighest(arr.slice(1));
var ret= res>=arr[0]? res:arr[0];
return ret;
}
}
Equals(findHighest([-1, 3, 5, 6, 99, 12, 2]))
```

When I console.log “res”, the first number it prints is ‘2’. Why would slicing the array result in the the last index of that array?

Also if the first number is 2, then why does res>=arr[0] print false if 2 is greater than -1.

If anyone can help me understand this it would be greatly appreciated