I saw this example in eloquent javascript and was wondering how this function works. Could someone please explain this to me?
function multiplier (factor) {
return function(number){
return number * factor;
};
}
var twice = multiplier(2);
console.log((twice(5));
// 10
I am able to follow parameter factor = 2.
Im confused about twice(5) and how that becomes the parameter number.