Instructions
After cloning:
npm install
npm test
...then make the tests pass.
Once you've completed the basic tests which help you practice writing code, move on to the stories below where you will practice writing your own tests.
Use TDD to implement the functions and methods below. The features can help you form tests before you begin coding.
Implement Array.prototype.mapper()
which functions the same as Array.prototype.map()
.
- mapper takes a callback
- mapper is an Array method
- applies the callback to the array
- returns the expected result of the callback
Implement Array.prototype.filterer()
which functions the same as Array.prototype.filter()
.
- filterer takes a callback
- filterer is an Array method
- filters the array with the callback
- returns the expected result of the callback
Resources:
Try to practice one algorithm a day. If you don't come up with a solution by the end of the day, look up the solution and study it! Don't stay stuck on a problem for too long. You'll benefit more from studying the solution and trying again afterwards.
Summary
During a white board session, go step by step, asking questions throughout:
- Analyze and question
- What does the algorithm do?
- What are the inputs and outputs (data types)?
- Any restraints or rules?
- Example/test of how it will be used
- Visualize and discuss (draw it out if necessary)
- Pseudocode the approach
- Code