/cpln692-week3

The use of functions and higher order functions

Primary LanguageJavaScript

Week 3

As always: make a copy of this repository to commit changes to

Class Outline

slides

Week 2 Review & Introduction

  • Posting in Gitter
  • Functions
  • Data structures

Functions continued

Section 1: Using functions (liberally!)
  • Function anatomy
    • Naming functions
    • Providing arguments
    • The function body
    • The return statement
  • Thinking functionally
    • Programs are data and its transformations
    • Functions are just transformations on data
    • Functions as values
  • Lab 1

Live coding: refactoring code into functions

  • Step through the code and discuss
  • Imagine alternative code flows
  • Organize the code
  • Make code DRYer ('don't repeat yourself')
    • Redundant code is a headache to maintain

underscore.js

Section 2: Library overview
  • Selecting (filtering for) elements in lists
  • each: No more for loops!*
  • Lab 2

*Mostly!

Homework Assignment (Due: Wednesday, February 1)

  • Complete Week 3 Lab1 (entirely)
  • Complete week 3 Lab2 (parts 1 and 4 only)