What does it mean that functions are "first-class" in JavaScript? What is a higher-order function? Give examples from the standard library.
Show the explanation
Model answer. First-class means functions are ordinary values: you can store them in variables, put them in arrays or objects, pass them as arguments and return them from other functions.
A higher-order function is a function that takes a function as an argument or returns one.
Standard examples: map, filter, reduce, sort (with a comparator), setTimeout, addEventListener, Promise.prototype.then.
// takes a function
const shout = words => words.map(w => w.toUpperCase());
// returns a function
const multiplier = factor => n => n * factor;
const triple = multiplier(3);
triple(7); // 21Higher-order functions let you separate what to do (the callback) from how to iterate or schedule it, which keeps code short and reusable.
Original UniCircle question. Last reviewed 22 Oct 2026.
