Click on text below to jump to specific point in the video
In this video we are going to learn about recursion. We will learn what recursion is, how to do it and why it is useful. Recursion is when a function calls itself until it doesn't.
Start of demoWe will implement a countdown function. Start by declaring the functon.
let is just the new var. Arrow functions is a shorter function syntax.
Recursion function example. It worked, but there was no stop condition. Lets add the stop condition.
We have learnt what recursion is and a simple example of how to do it. Why should we use it?
There are things recursion can do that loops cannotExample: hierarchical records.
A good trick in programming - take some time to think about the goal.
Walk through of the code exampleTo a certain degree you can do this with loops. Only works for limited amount of nesting. Video outline created using VideoJots