Course contentsShow
← JavaScript
Lesson 577 of 2,72314. The 'this' KeywordFree lesson

No 'arguments' Object in Arrows

Arrow functions don't have their own 'arguments' object; they inherit it from the enclosing scope.

No 'arguments' Object in Arrows

What you'll learn: Arrow functions don't have their own arguments object like regular functions do.

The Core Difference

Every regular function in JavaScript automatically gets a special arguments object that contains all the arguments passed to it. Arrow functions break this pattern—they simply don't have their own arguments object.

When you try to access arguments inside an arrow function, JavaScript looks up the scope chain and finds whatever arguments exists in the surrounding context. This is lexical inheritance, just like how arrow functions inherit this.

function outer(a, b) {
  console.log(arguments); // [1, 2]
  
  const arrow = () => {
    console.log(arguments); // Still [1, 2] - from outer!
  };
  
  arrow(3, 4); // Arguments 3 and 4 are ignored
}

outer(1, 2);

Why This Matters

If you need access to the actual arguments passed to an arrow function, you're out of luck with arguments. Instead, use rest parameters:

const regular = function() {
  console.log(arguments); // Works: Arguments object
};

const arrow = (...args) => {
  console.log(args); // Use rest parameters instead
};

regular(1, 2, 3); // [1, 2, 3] as arguments object
arrow(1, 2, 3);   // [1, 2, 3] as real array

Think of It Like This

Imagine a regular function as someone with their own notebook—they write down who visits them. An arrow function is like someone without a notebook, so when you ask "who visited you?", they check their parent's notebook instead.

Key Takeaway: Arrow functions don't have their own arguments object; they inherit it from the enclosing function scope. Use rest parameters (...args) if you need to capture arguments in an arrow function.