About Lesson
Higher-order Functions
Functions that accept other functions as arguments or return functions as their result.
Example:
JavaScript
function repeat(n, action) {
for (let i = 0; i < n; i++) {
action(i);
}
}
repeat(3, console.log); // Prints 0, 1, 2