Using function.call to Call a Function

In JavaScript, there is a way to call a function by using the .call() method. The syntax of the .call() is as follows:

functionName.call(thisArg, arg1, arg2, ….) // arg1 and arg2 are optional


functionName: Refers to the function being called and. thisArg specifies the object that this references inside the invoked function.

Try it