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:
- by defining a
self = this
variable, - by using the
bind
function.
In our first example, we will attempt to animate a ball using the setInterval
method.
Get hands-on with 1400+ tech skills courses.