Skip to content

Instantly share code, notes, and snippets.

@sharmaabhinav
Last active November 6, 2017 05:10
Show Gist options
  • Select an option

  • Save sharmaabhinav/8f80f56d25cf7f6232f9402e99e6421f to your computer and use it in GitHub Desktop.

Select an option

Save sharmaabhinav/8f80f56d25cf7f6232f9402e99e6421f to your computer and use it in GitHub Desktop.
function bind (fn, context, params) {
return function callable () {
fn.apply(context, [...params, ...arguments])
}
}
/*
function foo (a,b,c) {
console.log(this, a,b,c)
}
var obj = {name: 'obj'}
var fooCall = bind(foo, obj, [])
console.log(fooCall(7,8,9))
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment