Function.proto.call() v.s. apply()

by Carl Bowen

JavaScript

let customer1 = { name: 'Leo', email: '[email protected]' };
let customer2 = { name: 'Nat', email: '[email protected]' };s

function greeting(text) {
    console.log(`${text} ${this.email}`);
}

greeting.apply(customer1, ['Hello']); // Hello Leo		array-like args
greeting.call(customer2, 'Hello'); // Hello Nat				comma separated args