javascript
Find the maximum value from an array using Javascript
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);
Example Demo
Was this helpful?
Similar Posts
- Find the index of Max value in an array using Javascript
- Find the minimum value from an array javascript
- Convert object {key: value} to Array [[key, value]] Javascript
- Simplest Way to Find the Smallest Number in an Array using JavaScript
- Find the Third Smallest Number in an Array using Javascript
- Array.find() - get the very first element satisfy a condition Javascript
- Filter an Array using object key value in Javascript