I am a bit confused about this code, mainly the return function. I understand it takes the two parameters given and then multiplies them, but I don't know why or how the function number represents 5 in this case, and how it knows to multiply.
Everyone has been so helpful, I now understand what higher-order and realized it is just the arrow function that is making me confused. I need to try and understand them a little bit more.
function multiplier(factor) {
return number => number * factor;
}
let twice = multiplier(2);
console.log(twice(5));