This Binding

Med
Code
Loading editor...
Tap Analyze to see visualization
Variables

Run code to see variables

Output

Console output will appear here

Press Space to start to step? all shortcuts

Solution Guide: This Binding

Approach

Demonstrate the four rules of this binding: method call (implicit), bind (explicit hard binding), call/apply (explicit), and arrow functions (lexical). Each pattern shows how JavaScript resolves the this reference at the call site.

Complexity Analysis

Time
O(1)
Space
O(1)

Pattern

This Binding Rules

Why It Works

The value of this is determined by how a function is called, not where it is defined. Arrow functions are the exception: they capture this lexically from their enclosing scope at creation time.

Updated Feb 2026