Functions

Higher-order function

Try the free JavaScript compiler

A function that accepts or returns functions. Passing behavior as data lets callers select a transformation independently of the control flow.

Formal Syntax & Structure

javascript syntaxjavascript
function transform(value, callback) { … }

Working Example

Example Snippetjavascript
function apply(n,f){return f(n);}console.log(apply(3,n=>n*n));
JavaScript Reference