mercredi 26 septembre 2018

Most efficient way to find max/min element in array of array

I'd like to know how Can I return the min/max element in array of array Efficiently. I know I can do a loop throught the array but I think there may be a better option.

let tab= [2];
tab[0] = [{name :"book", value : 8}, {name :"cake", value : 2}]
tab[1] ... etc

I want to find the min or max value in this array for example.




Aucun commentaire:

Enregistrer un commentaire