Day 4: Loops
Lesson 5: Continue
Similar to break
this command skips the rest of that loop iterations code. But doesn't end the loop.
So, with the example from before:
In this case you can see that 11 isn't logged, because the loop has ended before it can print it. Rather than exiting the loop though it goes to the next iteration.
A practical use for this would be creating a filter, like this:
.push(age)
is a way to add an element to the end of an existing JavaScript array. Notice how adding the age to the filtered array doesn't remove it from the first array. This means we can make new copies of our data and work in a safe way without loosing what we started with.