sort()
Puts a list in order, changing the list itself.
What does sort() do in JavaScript?
sort() — Puts a list in order, changing the list itself.
const scores = [10, 2, 7];
scores.sort((first, second) => first - second);
Level: Journeyman · More JavaScript terms at this level
Updated