Welcome to week 6 of Intro to Web Dev!
Now you know how to use JavaScript, and you know how yo use if
statements, which let you make decisions in your code. This week you’ll learn about for
loops, which let you repeat code multiple times, and arrays, which let you store multiple values in a single variable.
Work through the activities in this page to complete the week!
First, watch this video and read through the tutorial to learn about for
loops:
Then, watch this video and read through the tutorial to learn about arrays:
What does this code output?
let total = 0;
for (let number = 1; number <= 10; number++) {
total += number;
}
console.log(total);
Note: Feel free to copy this code into your editor to see the result!
Now you’ve seen the fundamentals of for
loops and arrays in JavaScript.
To practice these concepts, modify the files in the week-06-for-loops
directory of your project repo.
This video is an example of coding part of this week’s project:
for
loops and arraysweek-06-for-loops
directory of your project repo