Skip to content

Instantly share code, notes, and snippets.

@sunilmadaan07
sunilmadaan07 / bind.js
Last active July 11, 2017 07:05
bind, call and apply in javascript (brief description of bind, apply and call in javascript)
//@bind, apply, call in javascript
//@description
//@Question: If you want to use an arbitrary object as value of this, how will you do that?
/***********
Answer: There are at least three different ways to doing this by using bind, call and apply.
For example, I have a method named deductMontlyFee in the object monika
and by default value of this would be monika inside the method.
************/
/***********
If I bind the deductMontlyFee of monika with another object vikas