Javascript - Reflect and Function.prototype

Introduction

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.

Demo

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

const person = { /*from   w w w  .  j a  v  a  2 s  . c o  m*/
    name: "Jack" 
}; 

Function.prototype.apply.call(sayHello, person); 
Reflect.apply(sayHello, person); 
Reflect.apply(sayHello, person, []);

Result

Related Topic