day 3 review

Today we began with a timed self-assessment (45-min) in which we had to re-implement some of the familiar functions in the UnderscoreJS library from scratch:

  • a recursive function that accepts a dom node and returns true if it finds 5 or more divs in itself and child nodes (no jQuery allowed).
  • an 'each' function, which accepts a collection to iterate over and an iterator that will be called on each item in the collection.
  • a 'once' function that accepts a function and executes it once, and then does not allow it to be called again
  • a 'defaults' function that accepts an object and optionally any number of objects which contain default key:value pairs to be assigned to the first object if those keys are not already present.
  • a 'contains' function which returns true if a given target value is found in a collection

after this we began learning about stacks and the instantiation styles of data stuctures, while also exploring the red-green-refactor approach to writing code (aka Test Driven Development). In this, we will write tests for what we want our application to do, and we will write them to fail until we write the code that fixes them.