JavaScript this, call, apply & bind Quiz

This JavaScript quiz covers this, one of the most asked interview topics. You will work out what this is in methods, detached functions and arrow functions, and set it yourself with call, apply and bind.

Hard 10 questions ~8 minutes Pass at 80% Node.js 22

Choose a mode

Playing as a guest: sign in to keep your XP and streak.

Sample question

Question 1 of 10

What does this print?

const user = {
  name: "Ann",
  greet() {
    return `Hi, ${this.name}`;
  },
};
console.log(user.greet());
Show the answer

A. Hi, Ann When a function is called as user.greet(), this is the object before the dot. So this.name is "Ann".

What this quiz covers

  • this is decided by how a function is called, not where it is written
  • Losing this when a method is passed around
  • Arrow functions take this from the surrounding code
  • call and apply run a function with a chosen this
  • bind returns a new function with this fixed for good

Questions people ask

Do I need an account?

No. Anyone can play. Sign in to keep your XP, streak, badges and history.

Can I retake it?

Yes. Your best score is kept, and the questions and answers are shuffled each time.