Context Binding

introduction to context binding, animation of a ball using the setInterval method

In ES5, function scope often requires us to bind the context to a function. Context binding is usually performed in one of the following two ways:

  1. by defining a self = this variable,
  2. by using the bind function.

In our first example, we will attempt to animate a ball using the setInterval method.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.