1. 1
We’ve learned to do a number of interesting things with data using functions and using if/else statements. One thing that we haven’t learned yet is how to organize and store data. One way we organ…
2. 2
Let’s start by making an array and then seeing what it can do throughout the rest of this lesson.
3. 3
Great work. Now, what if we want to select one item from an array? Luckily, each item in an array has a numbered position. We can access an item using its number, just like we would in an ordinar…
4. 4
It is often convenient to know how many items are inside of an array. We can find this out by using one of an array’s built in properties, called .length. We can attach this to any variable hol…
5. 5
JavaScript has a surprise for us: it has built in functions for arrays that help us do common tasks! Let’s learn two of them. First, push() allows us to add items to the end of an array. Here is a…
6. 6
Now that we can push() items into an array, let’s pop one off, using pop(). pop() is similar to push(), except that it deletes the last item of an array. Here’s an example: var bucketList = [‘ite…
7. 7
Nice work! In this lesson, we learned these concepts regarding arrays: - Arrays are lists and are a way to store data in JavaScript. Each item inside of an array is at a numbered position. Array…
1. 1
One of a computer’s greatest abilities is to repeat a task over and over so we don’t have to. Loops let us tell the computer to loop over a block of code so that we don’t have to write out the same…
2. 2
Before we jump into writing a loop, let’s write the result of a loop, so that we can better understand how loops work.
3. 3
Instead of writing out the same code over and over, let’s make the computer loop through our array for us. We can do this with for loops. The syntax looks like this: var animals = [“Grizzly Bear…
4. 4
If we can make a for loop run forwards through an array, can we make it run backwards through it? Of course! We can make out loop run backwards by modifying the start, stop, and iterator condition…
5. 5
Let’s say that you and a friend would like to go on vacation together. You’ve both made arrays of your favorite places and you want to compare to see if any places match. This is a job for loops! …
6. 6
Awesome job! for loops are great, but they have a limitation: you have to know how many times you want the loop to run. What if you want a loop to run an unknown or variable number of times instead…
7. 7
Great job! In this unit we learned how to write less repetitive code with loops. - for loops allow us to repeat a block of code a known amount of times. - We can use a for loop inside another for …

What you'll create

Portfolio projects that showcase your new skills

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory