We have 3 functions listed below. Your challenge is to write these functions but do so using arrow functions. Once you're done writing these three functions, make sure it passes all the test cases.
const sum = function(a, b){
return a+b;
}
const multiple = function(a, factor=10){
return a*factor;
}
const reduce = function (list, callback){
var total = 0;
for(var i=0; i<list.length; i++){
total += callback(list[i]);
}
return total;
}
// sum(5,10) should return 15
// multiple(5,10) should return 50
// reduce([1, 2, 3], function(memo, num){ return memo + num; }, 0) should return 6
To better understand how reduce function is supposed to work refer to Underscore's official documentation about the reduce method