Javascript - Reflect and Function.prototype


It is recommended to use Reflect when calling methods on Function.prototype.

If the arguments list is null or undefined, Function.prototype.apply will call the function with no arguments, whereas Reflect.apply will throw an error.


function sayHello() { 
    console.log(`${} says hello`); 

const person = { /*from   w w w  .  j a  v  a  2 s  . c o  m*/
    name: "Jack" 
};, person); 
Reflect.apply(sayHello, person); 
Reflect.apply(sayHello, person, []);


Related Topic