7.
What does the Math.max() function do in JavaScript?
Returns the sum of all the numbers in an array.
Returns the maximum value from a string of numbers.
Returns the index of the largest element in an array.
Returns the largest of the given numbers.
Correct: D
The Math.max() function is used to find the largest value among a set of numbers or the maximum value in an array. It takes one or more arguments as parameters and returns the largest value.
const max = Math.max(1, 2, 3, 4, 5);
console.log(max); // Output: 5