Hello,
I tried to explain this on this topic, and Teller shows it with a great animation. It is about the logic of stack work. This means that the task which comes last in the memory stack is worked on first. You should read this post step by step. Also, try to follow each step on the animation.
Additionally, think of the memory stack here as a box where tasks are placed on top of each other. One task cannot be completed before moving on to the next task. And the first task here is to write all the numbers one by one until reaching the base case if condition. Initially, with the console log at the beginning of the function, 3 is printed, then since the condition in the if block is not met, it goes to the else statement and there the countDownAndUp function is called with number 1 decreased, and 2 is printed to the console. Immediately below, the number is attempted to be printed to the console again, but before that, since the function is restarted, the repetition of 3 is left below until the number-1 function is finished. The function adds new tasks to the stack by calling itself again before the function ends, and so on.