For the second part of your long weekend lab, we'd like you to rewrite some underscore.js methods and tests that make them pass. The functions you will be implementing are:
- First - http://underscorejs.org/#first
- Last - http://underscorejs.org/#last
- Uniq - http://underscorejs.org/#uniq
- Pluck - http://underscorejs.org/#pluck
- Contains - http://underscorejs.org/#contains
- Fork and Clone the repo and then run npm install to make sure you pull in Chai.
- First, start with some research, make sure you know exactly what these five functions do before you try to implement them on your own.
- The "describe" and "it" blocks have been written for you, so start by writing the appropriate tests that match what is inside the "it" block.
- Once your tests are written, try to write a function that makes the test pass.
Implement the function flatten - http://underscorejs.org/#flatten - you will need to use recursion to solve this.
Not only is reimplementing JavaScript functions a fantastic way to improve your JS and TDD skills - it's also a super super common interview question, so the more you can practice earlier the better. This is going to be challenging, but if you get stuck, move to the next function or use each other and Stack Overflow to help. We will review everything after the long weekend, so if you are struggling, don't get discouraged!