What is Call, Apply, Bind

Both call() / apply() to invoke the function immediately, bind() returns a bound function that, when executed later, will have the correct context (“this”) for calling the

call() and apply() serve the exact same purpose.
The only difference between how they work is that call() expects all parameters to be passed individually, whereas apply() expects an array of all of our parameters.

var obj = {
firstname: 'Johan',
lastname: 'Doe ',
getFullName: function() {
var fullname = this.firstname + ' ' + this.lastname;
return fullname;
function getDetails (country, city){
return this.getFullName() + 'lives in ' + city + ' and my country is ' + country
getDetails.apply(obj,['Aus', 'albama']); 

Bind an object to a function and reference it using this

var obj = {name:"ajay"};

var greeting = function(a,b,c){
    return "welcome "+this.name+" to "+a+" "+b+" in "+c;
var bound = greeting.bind(obj); 

A constructor is simply a function that is used with new to create an object.