The apply() method is a built-in JavaScript function method that allows you to call a function with a specific this context and arguments passed as an array.
It is very similar to call(), but arguments are provided in an array instead of individually.
1.Syntax
- functionName → the function you want to invoke
- thisArg → the value of this inside the function
- [argsArray] → an array (or array-like object) containing arguments
