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

The Four Binding Rules Preview

Overview of the four ways 'this' can be bound: default, implicit, explicit, and new binding.

The Four Binding Rules Preview

What you'll learn: How JavaScript decides what this means using four distinct binding rules that apply in different situations.

Now that you understand this uses dynamic binding (determined at call-time, not write-time), you need to know how JavaScript actually determines what this will be. The answer: JavaScript follows one of four binding rules — and they're applied in a specific priority order.

The Four Rules

Think of these rules as a decision tree JavaScript walks through every time a function using this is called:

  1. Default Binding — What happens when none of the other rules apply (the fallback case)
  2. Implicit Binding — When a function is called as a method on an object
  3. Explicit Binding — When you manually specify what this should be using special functions
  4. New Binding — When a function is called with the new keyword

Why Four Rules?

JavaScript gives you multiple ways to invoke functions, and each invocation pattern needs a clear rule for determining this. Having four distinct, prioritized rules means there's always a definite answer to "what is this?" — you just need to identify which rule applies to the current function call.

The Priority System

When multiple rules could apply, JavaScript has a priority order (which we'll explore in detail later). This ensures predictable behavior: the same function call will always bind this the same way.

Key Takeaway: JavaScript determines this using one of four binding rules — default, implicit, explicit, or new — applied in priority order based on how the function is called, not where it's written.