0Pricing
JavaScript Academy · Lesson

this Basics; call/apply/bind (intro)

Understand what this refers to in functions and methods; learn arrow this, and taste call/apply/bind.

this Basics; call/apply/bind (intro) is a free JavaScript Academy lesson on CoddyKit — lesson 3 of 3. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the JavaScript Academy learning path, one of 3 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Intro to this

Goal: See what this refers to in different calls, learn arrow this, and try call/apply/bind in tiny steps.

  • Method vs plain call
  • Arrow this
  • call/apply/bind
this Basics; call/apply/bind (intro) — illustration 1

Method call this

In a method call, this points to the object before the dot.

// Method call: this is the object before the dot
const user = {
  name: "Ayla",
  say() {
    console.log("I am", this.name);
  }
};

user.say();
this Basics; call/apply/bind (intro) — illustration 2

Plain call this

A plain call has this as undefined in strict mode. In browsers without strict mode it may be the window.

// Plain function call: this is undefined in strict mode
function show() {
  console.log("this is", this);
}

show();
this Basics; call/apply/bind (intro) — illustration 3

Arrow this (lexical)

An arrow function uses the outer this (lexical). Great for callbacks inside methods.

// Arrow functions do not have their own this
// They capture this from the surrounding scope
const team = {
  title: "Blue",
  start() {
    const report = () => {
      console.log("Team:", this.title);
    };
    report();
  }
};

team.start();
this Basics; call/apply/bind (intro) — illustration 4

call vs apply

call and apply run the function now with the given this.

// call/apply invoke the function with a chosen this
function intro(lang1, lang2) {
  console.log("User:", this.name, "knows", lang1, "and", lang2);
}

const person = { name: "Mina" };

// call passes arguments normally
intro.call(person, "JS", "TS");

// apply passes arguments as an array
intro.apply(person, ["JS", "TS"]);
this Basics; call/apply/bind (intro) — illustration 5

bind basics

bind returns a new function that remembers the chosen this for future calls.

// bind creates a new function with this fixed
function sayHi() {
  console.log("Hi from", this.name);
}

const dev = { name: "Lena" };

const sayHiFromLena = sayHi.bind(dev);

sayHiFromLena();
sayHiFromLena();
this Basics; call/apply/bind (intro) — illustration 6

bind vs call/apply quiz

Quick check: Fixing this.

this Basics; call/apply/bind (intro) — illustration 7

Recap

Recap: Method calls set this to the object, plain calls have this undefined in strict mode, arrows capture outer this, call/apply set it for one call, and bind fixes it for later calls.

this Basics; call/apply/bind (intro) — illustration 8

Frequently asked questions

Is the “this Basics; call/apply/bind (intro)” lesson free?

Yes — the full text of “this Basics; call/apply/bind (intro)” is free to read here on the web, and the JavaScript Academy course includes 3 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the JavaScript Academy course, upgrade to CoddyKit PRO.

What will I learn in “this Basics; call/apply/bind (intro)”?

Understand what this refers to in functions and methods; learn arrow this, and taste call/apply/bind. You practise JavaScript Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start JavaScript Academy?

No prior experience is required. JavaScript Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 3, so you can start here or from the beginning and move at your own pace.

How long does the “this Basics; call/apply/bind (intro)” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this JavaScript Academy lesson?

Yes. Every JavaScript Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Declarations vs Expressions, Arrow Basics
  2. Parameters, Defaults, Rest, and Returns
  3. this Basics; call/apply/bind (intro)
← Back to JavaScript Academy