Created
January 6, 2019 14:36
-
-
Save arunprabug/58c4da0bbd4c66d344b013b92f34ad03 to your computer and use it in GitHub Desktop.
bind,apply,call
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bind,apply,call | |
function foo(a,b){ | |
console.log(arguments); | |
console.log('below is apply call') | |
boo.apply(null,arguments); | |
console.log('below is apply call') | |
boo.apply(null,[a,b]); | |
console.log('below is call') | |
boo.call(null,a,b); | |
var tempFoo = boo.bind(null,a,b); | |
console.log('below is bind call') | |
tempFoo(); | |
console.log('below is normal call') | |
boo(a,b); | |
} | |
function boo(a,b){ | |
console.log(a,b) | |
}; | |
foo('arun','g'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment