Using the Implicit Context Object
var greet = function(name) {
console.log(this.toUpperCase() + ' ' + name);
}
// greet('Joe'); // blows up
greet.call('hello', 'Joe'); // 'hello' becomes the implicit 'this'
> HELLO JoeUsing Arguments Array and Apply
var greet = function(name1, name2) {
console.log(this.toUpperCase() + ' ' + name1 + ' ' + name2);
}
greet.apply('hi', ['Jack', 'Jill']);
> HI Jack Jill