This question already has an answer here:
What would be the most efficient way to take n smallest numbers from Array in Javascript
[[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]
Result is
[1,13,32,1]
This question already has an answer here: What would be the most efficient way to take n smallest numbers from Array in Javascript
Result is
|
|||
marked as duplicate by Oriol Jan 16 at 6:25This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. |
|||
Try ES6
ES5
|
|||||||||
|
array.map(subarray => Math.min(...subarray))
? – torazaburo Jan 16 at 6:20O(#ofArrays * largestArrayLength)
. – nem035 Jan 16 at 6:24Math.max
withMath.min
. – Oriol Jan 16 at 6:26