Skip to content

Instantly share code, notes, and snippets.

@sharmaabhinav
Created November 6, 2017 04:59
Show Gist options
  • Save sharmaabhinav/6f64d328cff39c4826b52697a2dafa23 to your computer and use it in GitHub Desktop.
Save sharmaabhinav/6f64d328cff39c4826b52697a2dafa23 to your computer and use it in GitHub Desktop.
function apply (fn, context, params) {
return fn.call(context, ...params)
}
var obj = {a: 2}
function foo (b,c,d) {
console.log(this.a, b, c, d)
}
console.log(apply(foo, obj, [2,3,4]));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment