A first-class function is a function value that JavaScript treats like other objects. You can assign it to a variable, store it as an object property, pass it as an argument, or return it from another function. section 2.3
This makes behavior reusable and replaceable. Instead of hard-coding what a loop does, pass an action, selector, or operation into a general-purpose function. section 2.3 section 2.5
Pass an operation as a value
function applyOperation(a, b, opt) { return opt(a, b); } const multiplier = (a, b) => a * b; applyOperation(2, 3, multiplier); // 6 Here, multiplier is not called when it is passed. The function itself becomes data that applyOperation can invoke later. section 2.3
var square = function (x) { #1
return x * x; #1
} #1
var square = x => x * x; #2
Compare a traditional anonymous function expression with its arrow-function form. section 2.3






