# sort()

*noun*

say it: **“SORT”** **/sɔːrt/**

The JavaScript array method that puts items in order, changing the array 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);
```

## In a sentence

- “names.**sort**() put the names in alphabetical order.”

Level: Journeyman · [More JavaScript terms at this level](https://www.ask-codey.com/glossary?category=javascript&level=3)

Updated: November 9, 2026

## In other subjects

- [sort() in Python](https://www.ask-codey.com/glossary/sort)

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