E21: Experience Underscore (Part 2)

In this experience, you will continue to gain familiarity with Underscore.

As before, we’ll use a Hawaii Open Dataset providing Five Years of UH Degree Data. Here’s a screen image of this dataset:

I suggest you go to Five Years of UH Degree Data and play around a little bit so you understand how the data is structured.

You should simply contine to work in the Fiddle you created as part of Part 1, since you may want to call some of the functions you created for that practice WOD.

As a reminder, here’s what the uhdata variable’s value looks like:

var uhdata = [
  {
    "FISCAL_YEAR":2010,
    "CAMPUS":"UH Manoa",
    "CIP":220101,
    "CIP_DESC":"Law",
    "GROUP1":"School of Law",
    "GROUP2":"School of Law",
    "GROUP3":"Law",
    "GROUP4":"",
    "GROUP5":"",
    "OUTCOME":"Other",
    "HAWAIIAN_LEGACY":"",
    "AWARDS":69
  },
  {
    "FISCAL_YEAR":2010,
    "CAMPUS":"Kapi`olani CC",
    "CIP":240101,
    "CIP_DESC":"Liberal Arts",
    "GROUP1":"General & Pre-Prof Ed",
    "GROUP2":"Liberal Arts",
    "GROUP3":"Liberal Arts",
    "GROUP4":"",
    "GROUP5":"",
    "OUTCOME":"Associate Degrees",
    "HAWAIIAN_LEGACY":"",
    "AWARDS":322
  }

The WOD

Let’s continue the fun!

  1. Start your timer.

  2. Use the functions provided by the underscore package to implement the following two functions. Note that your solutions cannot include a for loop or an if statement!

  3. totalDegreesByYear(data, year). This function can be passed uhdata and a year and returns the total number of degrees awarded in the passed year.

  4. listCampuses(data). This function can be passed uhdata and returns an array containing all the campuses referenced in the passed dataset.

  5. Press the “update” button to save your fiddle.

  6. Stop your timer and record your time. Be sure to record it, because you will need your WOD time data when you write your technical essay.

Rx: < 12 min Av: 12 - 15 min Sd: 15 - 20 min DNF: 20+ min

Demonstration

Once you’ve finished trying the WOD for the first time, watch me do it.

These two functions are solved starting at 20:44 in the following video:

Standard WOD Caveats

You’ll learn significantly less from watching me solve the WOD if you haven’t attempted the WOD yourself first.

While it’s an achievement to finish the WOD no matter how long it takes, you might experience “diminishing returns” if you work longer than the DNF time. Thus, it is usually strategic to stop working at the DNF time and watch my solution.

After watching my solution, I recommend that you repeat the WOD if you have not achieved at least Av performance. If so, be sure to:

Feel free to keep trying until you make Rx if that’s of interest to you.

Submission Instructions

To be completed by the time and date indicated on the Schedule page.