---
date: 2020-11-16
id: bf6cf8fb-dd68-43fa-927f-6efbc2bc8ead
title: Array.prototype.Sort()
---

# Description

Sorts array

# Syntax

``` javascript
const months = ['March', 'Jan', 'Feb', 'Dec'];
months.sort();
console.log(months); // ["Dec", "Feb", "Jan", "March"]

const array1 = [1, 30, 4, 21, 100000];
array1.sort();
console.log(array1); // [1, 100000, 21, 30, 4]
```

# Changes

[.sort() is guaranteed to be
stable](20201116155810-sort_is_guaranteed_to_be_stable)
