What will be the output of the following JavaScript code? [code] var arr = [7, 5, 9, 1]; var value = Math.max.apply(null, arr); document.wri

What will be the output of the following JavaScript code?
Code:
var arr = [7, 5, 9, 1];  
var value = Math.max.apply(null, arr);  
document.writeln(value);
A. 7
B. 5
C. 1
D. 9
 
Answer: d
Explanation: apply() is a predefined function method in javascript. The argument of apply() method contains elements of an array. It contains two values as argument which are optional as input.
 

Tìm kiếm

Back
Top