QamoosTech
Programming FundamentalsBeginner

Anonymous Function

Pronunciationuh-NON-uh-muhs FUHNGk-shuhn

Definition

A function defined without a name, usually passed directly as an argument or assigned to a variable.

Where you hear it

In code reviews, when discussing callbacks, event handlers, or functional programming patterns.

Examples

  • We used an anonymous function as a callback for the click event.
  • The sort method accepts an anonymous function to define custom ordering.

Common mistake

Thinking anonymous functions cannot have parameters, when they accept inputs just like named functions.