Calling a Function Using function.apply

Another way to invoke functions in JavaScript is using the .apply() method. The syntax for .apply() is as follows: functionName.apply(thisArg, [array]). "functionName" refers to the function being called. However, with .apply(), an array containing all values can be sent instead of individual arguments. Additionally, "thisArg" specifies the object that "this" references inside the invoked function.

Try it