Open In App
Related Articles

JavaScript Reflect apply() Method

Like Article
Save Article
Report issue

Javascript Reflect.apply() method is a standard build-in object in JavaScript which is used to call a function using the specified argument. It works similar to the Function.prototype.apply() method to call a function, but in an efficient manner and easy to understand.


Reflect.apply(target, thisArgument, argumentsList)

Parameters: This method accepts three parameters as mentioned above and described below:

  • target: This parameter is the target function that is going to be called.
  • thisArgument: This parameter has this value which is required for calling the target function.
  • ArgumentsList: This parameter is an array-like object specifying the argument with which the target should be called.

Return Value: Calling the given Target function resulted in the specified this value and arguments.

Exceptions: A TypeError is an exception given as the result when the target is not callable.

Below examples illustrate the Reflect.apply() Method in JavaScript:

Example 1: List argument is passed and dictionary – the object is created.


function geeks1(a, b, c) {
    this.x = a;
    this.y = b;
    this.z = c;
} const obj = {};
Reflect.apply(geeks1, obj, [12, 42, 32]);



{ x: 12, y: 42, z: 32 }

Example 2: In this example, the empty list argument is passed and the function is called. And the second portion contains mathematical computation, finding the minimum element from the list.


let geeks2 = function () { console.log(this); }
Reflect.apply(geeks2, 'GeeksforGeeks', []);
let list = [31, 45, 143, 5];
console.log(Reflect.apply(Math.min, undefined, list));



String { "GeeksforGeeks" }

Example 3: In this example, the list argument is passed with some values and the function is called converting the integer into character strings.


// Converting the list of integer into char string
            undefined, [103, 101, 101, 107, 115, 102,
            111, 114, 103, 101, 101, 107, 115]))
// Extract the indexed value of string(character)
console.log(Reflect.apply(''.charAt, 'shubham', [3]))




Supported Browsers: The browsers supported by JavaScript Reflect.apply() Method are listed below:

  • Google Chrome 49 and above
  • Edge 12 and above
  • Firefox 42 and above
  • Opera 36 and above
  • Safari 10 and above

We have a complete list of Javascript Reflects methods, to check those go through the JavaScript Reflect Reference article.

Last Updated : 30 May, 2023
Like Article
Save Article
Share your thoughts in the comments
Similar Reads