You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+34-2Lines changed: 34 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# White Boarding Advice
1
+
# Algorithms.js
2
2
3
3
*Instructions*
4
4
@@ -8,7 +8,39 @@ npm install
8
8
npm test
9
9
```
10
10
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
0 commit comments