Make use of the solution templates. These should help you also to get a better understanding of the tasks.
id
to a given value.Write a reduce function for Javascript arrays, in analog to Python's reduce. It should produce e.g.
reduce([1, 2, 3], function(x, y) { return x + y; }, 0) === 1 + 2 + 3;
Write a function to add a reduce method to the Array prototype. After calling the function, one should be able to get
[1,2,3].my_reduce(function(x, y) { return x * y; }, 1) === 1 * 2 * 3;