Skip to content

Functions

Functions are the building blocks of JavaScript. They are first-class citizens — they can be assigned to variables, passed as arguments, and returned from other functions.

  • Write functions using declarations, expressions, and arrow syntax
  • Understand parameters, arguments, and the arguments object
  • Master higher-order functions, callbacks, and closures
  • Use IIFEs, recursion, and pure functions
Declarations → Expressions → Arrow Functions → Parameters → Callbacks → HOFs → Closures → Recursion → IIFE → Pure Functions
TopicDescription
Function DeclarationClassic function definition
Function ExpressionFunctions as values
Arrow FunctionsConcise ES6 syntax
Anonymous FunctionsFunctions without names
Named FunctionsNamed function expressions
Callback FunctionsFunctions passed as arguments
Higher-Order FunctionsFunctions that take/return functions
Pure FunctionsDeterministic, side-effect-free
RecursionFunctions calling themselves
IIFEImmediately Invoked Function Expression
Default ParametersParameters with default values
Rest ParametersVariable-length arguments
arguments ObjectArray-like arguments access
Function HoistingHow functions are hoisted

3–4 hours

  • Scope
  • Execution Context
  • Closures