Week 04: Decisions and Loops

Lecture

This week will be talking about decisions and loops using JavaScript. Decisions are made in code using if statements, i.e. if this value is 5 or above make the background blue if its below 5 make the background red. Loops are one of the main things that makes programming great! We can loop through a large number of tasks and the computer will do those tasks pretty much instantly. For this we use something called a for loop or a while loop.

Download Lecture PDF

In Class Assignment

Create a wall paper pattern using loops, if statements and arrays. Try to play with Math.random() as well to create random patterns. Feel free to use images or divs to create this design.

Homework

Take what we did together in class and figure out how to shuffle the order of the tiles using a simple array shuffle function.