Mental Model
A function calls itself with a smaller number until it reaches 1, then multiplies all those numbers back up.
Analogy: Imagine stacking blocks: you keep adding one block on top until you reach the last block, then you count the total blocks by multiplying as you go back down.
factorial(4)
↓ calls factorial(3)
↓ calls factorial(2)
↓ calls factorial(1)
returns 1
returns 2 * 1 = 2
returns 3 * 2 = 6
returns 4 * 6 = 24