Calling a Function Using function.apply

Syntax

apply(thisArg)
apply(thisArg, argsArray)


Parameters

thisArg

The value of this provided for the call to func. If the function is not in strict mode, null and undefined will be replaced with the global object, and primitive values will be converted to objects.

argsArray Optional

An array-like object, specifying the arguments with which func should be called, or null or undefined if no arguments should be provided to the function.


Return value

The result of calling the function with the specified this value and arguments.