# 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.

```javascript
const scores = [10, 2, 7];
scores.sort((first, second) => first - second);
```

Level: Journeyman · [More JavaScript terms at this level](https://www.ask-codey.com/glossary/subjects/javascript/journeyman)

Updated: September 27, 2026

Source: https://www.ask-codey.com/glossary/sort-javascript
