Skip to content
UniCircle
MediumConceptualFunctions

Function declarations, expressions and arrows

Question JS-FUN-001

Compare a function declaration, a function expression and an arrow function. How do they differ in hoisting, this, and arguments?

Show the explanation

Model answer.

JavaScript
function add(a, b) { return a + b; }        // declaration
const sub = function (a, b) { return a - b; };  // expression
const mul = (a, b) => a * b;                // arrow function
  • Hoisting: a declaration is hoisted with its body, so you can call it above where it is written. Expressions and arrows are only available after the line runs (the variable is hoisted, the function is not).
  • `this`: declarations and expressions get their own this, decided by how they are called. Arrow functions have no own `this`; they use the this of the surrounding code. That makes arrows ideal for callbacks inside methods, and wrong as object methods that need this.
  • `arguments`: regular functions have an arguments object; arrows do not (use rest parameters ...args).
  • `new`: regular functions can be constructors; arrows cannot.

Rule of thumb: arrows for short callbacks, declarations for named top-level functions, and class methods for object behaviour.

Original UniCircle question. Last reviewed 22 Oct 2026.