Hello

I'm Ricardo, a full-stack human

Recursion baby

When a function calls itself until it doesn't. Seriously.

Use it when it feels natural. When you face a problem where it fits nicely, you will most likely recognize the scenario: it will seem like you cannot even come up with an iterative solution. Also, clarity is an important aspect of programming. Other people should be able to read and understand the code you produce.

let countDown = (from) => {
  if (!from) return;
  console.log(from);
  countDown(from - 1);  
}