Khoa Nguyen
Pressure creates diamonds
Skip to main content

JavaScript Advanced Concept Higher Order Functions

Last updated: 10 May 2024 (8 month ago)

Higher Order Functions

A higher order function is a function that takes a function as an argument, or returns a function. They are commonly used in functional programming, and are a powerful tool for abstracting away complexity.

// A function that takes a function as an argument
function add(x, y) {
  return x + y;
}
function subtract(x, y) {
  return x - y;
}
function math(x, y, operator) {
  return operator(x, y);
}

math(5, 2, add); // 7
  • E-commerce
  • Landing page
  • Usability
  • Accessibility
  • Information Architecture
  • Responsive Design