Finding the Maximum Value in an Array using JavaScript

To find the maximum value of an array of integers, we can use the Math.max() function and the spread operator to do it.

let numbers = [1, 2, 3, 4, 5];
let maxValue = Math.max(...numbers);
console.log(maxValue);  // Output: 5