why does this function return [‘y’,’e’,’s’]?

can someone please explain it to me how does this function return [‘y’,’e’,’s’] instead of just the string ‘yes’ ????
the value of num first will be 8 then else condition will work then num will be [5,6,7] and again the else condition will work then num finally becomes an empty array [] which will fullfill the if condition then it should return ‘yes’ but it doesn’t!?

function ABC(num, ...rest) {
  if (num < 5) {
    return 'yes';
  } else {
    return [...ABC(rest)];
  }
};
console.log(ABC(8, 5, 6, 7));