I'm having trouble understanding the behavior of the code below:
function multiplier(factor){
return number => number * factor;
}
let twice = multiplier(2);
console.log(twice(5));
At the function call multiplier(2), the value of 2 is returned to the binding twice, which is 2, but how so? This implies that the return statement would evaluate to 1 * 2, but the parameter number was never assigned a value. I was expecting undefined * 2, instead which would return undefined. Why is the parameter number assigned a value of 1?