const myarr = [10, 23, 65, 7, 24];
const min_val = myarr.reduce((a, b) => a < b ? a : b);
console.log(min_val);
Here we have an array which has five integers values in it and we want to get the lowest value which this array contains. We are using .reduce() method of array for this purpose.
0 Comments