TheIronYard--Orlando / FEE--2015--SPRING

Class projects for the Front-End Engineering cohort of @TheIronYard--Orlando for Spring 2015
Creative Commons Zero v1.0 Universal
13 stars 6 forks source link

13 -- Lists+Dicts -- Sam Kauffman #160

Open sak55 opened 9 years ago

sak55 commented 9 years ago

Tasks

sak55 commented 9 years ago

my PR https://github.com/sak55/TIY-Assignments/pull/17

sak55 commented 9 years ago

13 -- Of Lists and Dictionaries

Description

try out our new Array and Object literals on those mean ole String Calculator and Check Writing katas. Before Take a Picture of your logic for practice. You'll need to learn some more Array methods before we prep the floor for some API Gymnastics.

Take a Picture

Using a diagramming tool of your choice -- Google Drawings, Gliphy, OmniGraffle, photos of pen and paper -- render a clean drawing of the logic in the toEnglish function from Check Writing. Save a copy of the resultant image as docs/toEnglish.png and commit it into your branch.

One More Time...

Think you've mastered the String Calculator and Check Writing katas? Not by a long-shot...! Refactor your "production" (i.e. not-"test") code to use Array and Object literals as Lists and Dictionaries per the examples below.

Reading JavaScript: Array Iterators

Highly recommended BEFORE API Gymnastics, document the non-experimental Array Iteration Methods and attempt to re-implement at least 3 using Array.prototype.forEach. BEAST MODE: Also include find and findIndex. See Requirements below for an example of every().

API Gymnastics: Floor Routines

Use the curl command to get some crazy event data from the Github API and stick it in a file called apis/github/users/USERNAME/events.json where USERNAME is your Github profile name, e.g. apis/github/users/al-the-x/events.json for moi: al-the-x. Yes, you'll have to create some empty directories along the way... Remember how to do it in one step? Hint: Use the funnel, Luke! Following the Requirements below, use your iterator methods to pull some numbers from the data.

Deliverables

Format for Reading JavaScript


Literal: Array

. . .

Iterator Methods

Array.prototype.every
function every(anArray, callback){
  var hasFailed = false; // it hasn't has it?

  // iterate...
  anArray.foreach(function(item, index, all){
    if ( hasFailed ) return; // one failure ruins everything...

    hasFailed = !callback(item, index, all); // why invert here?
  });

  return !hasFailed; // Another inverse?
  // What if `anArray` is empty?
}

API Gymnastics

Next, use the methods of Array that you've documented to uncover some statistics about your progress. You can create as many functions as you like to help you derive the answers, but place the final invocations (not just the values) into a function called answers that returns the following:

LoganArnett commented 9 years ago

Looking for those :+1: on that PR