+ 1
How to define the max value in array[0].x;
function s(x) { this.x = x; } var array = [ [ new s(100), new s(0), new s(1020) ], [new s(100)], [new s(100)] ]; //the max value in array[0].x is 1020 but how to do it, please.
2 ответов
+ 3
var max = Math.max(...array.flat().map(a=>a.x));
https://code.sololearn.com/WrCI9kkw5weV/?ref=app
+ 2
Thank you.