The JavaScript Function apply() method calls a function containing this value and a single array of arguments.
Syntax:
function.apply(thisArg, array)
Parameters:
thisArg: It is used as this keyword for the call to a function. It is an optional parameter.
array: It represents an array-like object.
Return:
Result of the invoking function.
Example:
<!DOCTYPE html> <html> <body> <script> var a = [100,40,678,435,890]; var greatest = Math.max.apply(null, a); document.writeln(greatest); </script> </body> </html>