Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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'
Add Comment
Please, Sign In to add comment