ECMAScript6 Reflect.apply method

The ECMAScript6 Reflect.apply method takes in three parameters, 1) The target function, 2) An optional object which will be used inside the target function and, 3) An optional array object which will be used inside the target function. Below is an example of the usage of the Reflect.apply method.

(function() {
	
function multiply_by(a, b, c) {
	return this.value * a * b * c;
}

result = Reflect.apply(multiply_by, {value : 1}, [2,3,4]);

console.log(result); //output 24

})();

Please take note that the keyword this in the function represents the second object parameter in the Reflect.apply method.

Like this post? Kindly share!