The code can be helpful to get the maximum value from an array using Javascript. We are using .reduce() method of array to find the maximum value from array.
const myarr = [10, 23, 32, 65, 7, 24];
const max_value = myarr.reduce((a, b) => a > b ? a : b);
console.log(max_value);
0 Comments