I have a multidimensional array of x columns and y rows. How can I find the min and the max value of the matrix? Example:
[[1, 37.8, 80.8, 41.8], [2, 30.9, 69.
based on this answer, you can do it in 1 line (assuming ES6):
const arr = [[12,45,75], [54,45,2],[23,54,75,2]]; const max = Math.max(...[].concat(...arr)); const min = Math.min(...[].concat(...arr)); console.log(max); console.log(min);