30 Days Of JavaScript

Day 4: Loops

Lesson 0: Intro

If logic and conditionals were the first step in you feeling like a coder, then today is going to take that feeling home.

In day 2 we looked at grouping data, so that we didn't have to keep creating new variables for every piece of data. I showed you how to access that data and change it. What I didn't show you is how to work with that data as a group.

Today we fill in that blank 🥳 Today, we talk about loops.

If you think about an array like a book case where index 0 is the first/lowest shelf and then each shelf is index + 1 (so 0, 1, 2, 3) until the ceiling is reached. You want to look at the contents of each shelf, in order to do this you would look at shelf 0, then shelf 1, then 2 etc.

Well looping in programming allows us to do the same. There are a number of ways of looping in JavaScript and today we will look at:

  • for
  • while
  • for of

Then we'll wrap up with two keywords called break and continue


Go Pro?

If you upgraded to pro, sign in here

  • About
  • Blog
  • Privacy
Looking to email me? You can get me on my first name at allthecode.co