0 votes
in JavaScript by
Which one of the following options is the correct output for the given code of JavaScript?

vararr=[1, 3, 5, 8 ,11];  

var value =Math.max.apply(null,arr);  

document.writeln(value);  

a) 7

b) 11

c) 3

d) 9

1 Answer

0 votes
by

Answer: B

Reason: The "apply()" used in the above given code is a pre-defined method in which an array is passed as an argument and another argument passed a NULL. Here this method searches for the largest integer in the whole array

Related questions

0 votes
asked Mar 22, 2021 in JavaScript by Robindeniel
0 votes
asked Mar 21, 2021 in JavaScript by rajeshsharma
...