/MUSA611-CPLN692-week3

Functions, higher order functions, and libraries

Primary LanguageJavaScript

Week 3

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

Week 2 Review

Skills Review

  • Data structures (arrays & objects)
  • Loops

Homework and labs

  • Review of our first assignment
  • Questions and demonstration

Lecture and Labs

Example leaflet application

  • In class walk-through of example application

Lab 1: Using functions (liberally!)

  • Function anatomy
    • Naming/defining functions vs calling functions
    • Providing arguments
    • The function body
    • The return statement
  • Thinking functionally
    • Programs are data and its transformations
    • Functions are just transformations on data
    • Functions are values
  • Lab 1

Live coding: refactoring code into functions

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

underscore.js

Lab 2: Library overview

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

*Mostly!

Assignment

  • Complete Week 3 Labs
  • Review difficult concepts (this is subjective)
  • Finish week 2 assignments if necessary