Skip to content

Commit a9eee0e

Browse files
author
Kay Hudson
committed
Add instructions for TDD.
1 parent 83afd2b commit a9eee0e

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

README.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# White Boarding Advice
1+
# Algorithms.js
22

33
*Instructions*
44

@@ -8,7 +8,39 @@ npm install
88
npm test
99
```
1010

11-
...then make the tests pass
11+
...then make the tests pass.
12+
13+
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.
14+
15+
## Exercises
16+
17+
Use TDD to implement the functions and methods below. The features can help you form tests before you begin coding.
18+
19+
Implement `Array.prototype.mapper()` which functions the same as `Array.prototype.map()`.
20+
21+
* mapper takes a callback
22+
* mapper is an Array method
23+
* applies the callback to the array
24+
* returns the expected result of the callback
25+
26+
Implement `Array.prototype.filterer()` which functions the same as `Array.prototype.filter()`.
27+
28+
* filterer takes a callback
29+
* filterer is an Array method
30+
* filters the array with the callback
31+
* returns the expected result of the callback
32+
33+
Implement a `range(start, stop, step)` function which creates a new array. It has 1 mandatory argument: the length of the resulting array. It can take up to 3 arguments though: starting and stopping point OR starting and stopping point and steps (increments).
34+
35+
```
36+
// Example usage:
37+
range(10) //-> [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
38+
range(1, 10) //-> [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
39+
range(1, 10, 2) //-> [ 1, 3, 5, 7, 9 ]
40+
```
41+
42+
* the step argument works with all integers (positive and negative)
43+
* the stop and start arguments must be positive integers only
1244

1345
Resources:
1446
* [Algorithm Deck](https://drive.google.com/open?id=1raZx8K8cWmQkwmjxJ3qZ-GG6zEAawtsmtGgxnd-DXfU)

0 commit comments

Comments
 (0)