Week 6: Array Methods and Iterators

To Do This Week:

Assignments:

Codecademy: Complete the lessons (not the projects) from the Learn JavaScript module:

  1. "Iterators"

Decribe your idea and the detailed logic steps for the Interactive Website.

Read (Optional!): Chapters from Eloquent JavaScript:

Upcoming Assignments


Module Notes

In-class Exercise:

Quick Review: Change Background Color

Changing CSS with JavaScript:



Review JavaScript and the DOM:

Traversing // get to elements on the page

Creating & Adding Elements // create new elements and add them to the page

Forms: Accessing Values

JavaScript Methods (in-built functions):

Math Methods:

Switch vs Conditionals


// Example using switch
let day = 3;

switch (day) {
 case 1:
  console.log("Monday");
  break;
 case 2:
  console.log("Tuesday");
  break;
 case 3:
  console.log("Wednesday");
  break;
 default:
  console.log("Other day");
}
// Example using else if let day = 3;

if (day === 1) {
  console.log("Monday");
} else if (day === 2) {
  console.log("Tuesday");
} else if (day === 3) {
  console.log("Wednesday");
} else {
  console.log("Other day");
}

Array Methods

Array Iterators

forEach() (very useful)

forEach() - w3schools
forEach() Demo