Counting by Steps
Skip values.
Big Steps! 👣
Last time we counted 1, 2, 3 by adding ONE each time. But what if we want to SKIP? 🦘
Like 2, 4, 6, 8! Today we learn to count by steps.
Change the Step 🔧
The third part of the loop is the step. Instead of i++ (add 1), we can write i = i + 2 to add 2!
for (let i = 2; i <= 10; i = i + 2) {
console.log(i)
}All lessons in this course
- Counting Up
- Counting by Steps
- Counting Down
- Number Patterns