Skip to content

Instantly share code, notes, and snippets.

@JunPyoL22
Created March 8, 2018 15:53
Show Gist options
  • Save JunPyoL22/06ec13f8e78f073a3712d23ec6344010 to your computer and use it in GitHub Desktop.
Save JunPyoL22/06ec13f8e78f073a3712d23ec6344010 to your computer and use it in GitHub Desktop.
var indirect = { name: 'indirect function invocation' };
function concatName(string) {
console.log(this === indirect); // => true
return string + this.name;
}
// Indirect invocations
concatName.call(indirect, 'Hello '); // >> 'Hello indirect function invocation'
concatName.apply(indirect, ['Bye ']); // >> 'Bye indirect function invocation'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment