The concept of explicit binding refers to the use of methods such as .call, .apply, and .bind in JavaScript to specify the value of the this keyword within a function.

It is important to note that if you use strict mode, using the this keyword without binding it explicitly will result in an error and the this value will be set to the window object. Additionally, without explicit binding, this will always refer to the window object.

Explicit binding examples with .call, .apply and .bind

.call example

.call example

first param is the this context and the others are the params of the function

.apply example. It’s the same of call, but has a array

.apply example. It’s the same of call, but has a array

.bind example. It works like call but it not immediately call the function

.bind example. It works like call but it not immediately call the function

It will trow error bcause use strick blick the this get the window object

It will trow error bcause use strick blick the this get the window object

There this will get the window object always

There this will get the window object always