You have already passed functions to array methods and returned functions from closures. Here you will make a reusable multiplier in script.js, then inspect the Console result.
A higher-order function either accepts a function or returns one. Returning a multiplier function is a clean beginner example because it shows functions as reusable values.
function makeDiscount(percent) {
return function (price) {
return price * (1 - percent);
};
}
console.log(makeDiscount(0.2)(50));
makeMultiplier(multiplier) so it returns a function that multiplies its input by the captured multiplier.makeMultiplier(3)(7) as its own Console line.Return an inner function that multiplies its input by multiplier.
Call the returned function with 7 after creating it with 3.