JavaScript Function apply() method

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 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>

Output:

890
Please Share