Skip to content

Commit 0efec3b

Browse files
committed
[exercises/implement_map_with_reduce] Highlight bonus points for implementing thisArg.
Also fixes solution function name. Closes timoxley#96.
1 parent 5de1635 commit 0efec3b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

exercises/implement_map_with_reduce/problem.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ console.log(output) // => [2,4,6,8,10]
2424
* input: an arbitrary Array of any type.
2525
* operation: an arbitrary Function which can be applied to items in `input`.
2626

27+
## Hints
28+
29+
* No need to implement the optional `thisArg` argument of `Array.prototype.map`, bonus points if you do!
30+
2731
## Resources
2832

2933
* https://en.wikipedia.org/wiki/Reduce_(higher-order_function)

exercises/implement_map_with_reduce/solution/solution.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = function map(arr, fn, thisArg) {
1+
module.exports = function arrayMap(arr, fn, thisArg) {
22
return arr.reduce(function(acc, item, index, arr) {
33
acc.push(fn.call(thisArg, item, index, arr))
44
return acc

0 commit comments

Comments
 (0)