tri.js généralisation tri par numéro (croissant/décroissant)
This commit is contained in:
parent
944aed6fd2
commit
33aa593e9d
3
tri.js
3
tri.js
@ -9,7 +9,8 @@ function trierNumeros(tnumeros, tnoms, croissant = true)
|
|||||||
o.nom = tnoms[i];
|
o.nom = tnoms[i];
|
||||||
tab.push(o);
|
tab.push(o);
|
||||||
}
|
}
|
||||||
tab.sort((a, b) => { return a.numero - b.numero; });
|
ordre = croissant ? 1 : -1;
|
||||||
|
tab.sort((a, b) => { return ordre * (a.numero - b.numero); });
|
||||||
return tab;
|
return tab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user