Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

higher order function

// A function that returns a function is called a higher-order function.

/*
In this example, we are returning a function from another function - 
We can return a function because functions in JavaScript are 
treated as values.
*/

function sayHello() {
  return () => {
    console.log("Hello!");
  }
}
 
PREVIOUS NEXT
Tagged: #higher #order #function
ADD COMMENT
Topic
Name
5+3 =