This is, by the way, a good trick whenever you’re programming — to always think about what it is you’re doing — what is my end goal? — instead of just starting to code. I think one of the most common mistakes in programming is to start coding too early. Take some time to think about your problem and where you’re going and that will save you a lot of time.

Mattias Petter Johansson (MPJ)

Recursion - Part 7 of Functional Programming in JavaScript