why does javascript recursion acts weirdly? [closed]

let queue = [];
function recursion(num) {
  if (num in queue) {
    return `input${num}: ${queue.length}: ${queue}`;
  } else {
    console.log(`${queue}, ${num} is in queue: ${num in queue}`);
    queue.push(num);
    if (num % 2 === 0) return recursion(num / 2);
    if (num % 2 !== 0) return recursion(num + 3);
  }
}
console.log(recursion(3));

this code gives some weird results. I don’t understand where the code goes wrong.