I am trying to work with higher order functions, in an attempt to be a better javascript developer.
The error I'm getting from the code below is TypeError: myArray.reduce is not a function
I swear I'm following the correct design pattern.
function myFunction(myArray) {
return myArray.reduce((prev, curr) => prev * curr);
}
var myArray = [3, 2, 3]
var myObject = myFunction.apply(myObject, myArray); // Will each element in array be multiplied?