# How to empty a JavaScript array

> Learn how to empty a JavaScript array, either by setting its length to 0 to clear it in place or by reassigning the variable to a new empty array with let.

Author: [Flavio Copes](https://flaviocopes.com/about/) | Published: 2018-12-03 | Topics: [JavaScript](https://flaviocopes.com/tags/js/) | Canonical: https://flaviocopes.com/how-to-empty-javascript-array/

There are various ways to empty a [JavaScript](https://flaviocopes.com/javascript/) array.

The easiest one is to set its length to 0:

```js
const list = ['a', 'b', 'c']
list.length = 0
```

Another method mutates the original array reference, assigning an empty array to the original variable, so it requires using `let` instead of `const`:

```js
let list = ['a', 'b', 'c']
list = []
```
