Easy'this' Binding💻 Output Question

Arrow function has no own this — inherits lexically

💡

Hint

Arrow functions do not have their own this. Never use them as object methods.

What does this output?

const obj = {
  name: 'JSPrep',
  arrow: () => typeof this,
  regular() { return typeof this; },
};
console.log(obj.arrow());
console.log(obj.regular());

Correct Output

undefined
object

Why this output?

Explanation: Arrow functions inherit this from the enclosing lexical scope. At module level this is undefined. Regular methods get this set to the calling object.

Key Insight: Arrow functions do not have their own this. Never use them as object methods.

More 'this' Binding Output Questions

EasyMethod call — this is the calling objectMediumbind permanently fixes this — call cannot override itMediumcall vs apply — same result, different syntaxMediumArrow callback inside method preserves this

Practice predicting output live →

66 output questions with instant feedback

💻 Try Output Quiz