@riana ·

Understanding This, Bind, Call, and Apply in JavaScript

This article was originally written for DigitalOcean. I selected the Open Internet/Free Speech Fund to receive a donation as part of the Write for DOnations program.

The this keyword is a very important concept in JavaScript, and also a particularly confusing one to both new developers and those who have experience in other programming languages. In JavaScript, this is a reference to an object. The object that this refers to can vary, implicitly based on whether it is global, on an object, or in a constructor, and can also vary explicitly based on usage of the Function prototype methods bind, call, and apply.