Skip to content

Instantly share code, notes, and snippets.

@kikar
Last active March 10, 2016 23:22
Show Gist options
  • Save kikar/20cd17d8148752a490da to your computer and use it in GitHub Desktop.
Save kikar/20cd17d8148752a490da to your computer and use it in GitHub Desktop.
function foo(type) {
console.log( type + this.a );
}
var obj = {
a: 2,
};
foo.call(obj, 'Call: '); // Call: 2
foo.apply(obj, ['Apply: ']); // Apply: 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment