> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sourcery.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Use-Array-Literal

#### Sourcery rule id: `use-array-literal`

#### Description

Use literal syntax for array creation.


#### Before

```javascript
const items = new Array();
```

#### After

```javascript
const items = [];
```



#### Explanation

Use of the Array constructor to construct a new array is generally discouraged in favor of
array literal notation because of the single-argument pitfall and because the Array global
may be redefined. The exception is when the Array constructor is used to intentionally create
sparse arrays of a specified size by giving the constructor a single numeric argument.

From [ESLint](https://eslint.org/docs/latest/rules/no-array-constructor.html)
From the [Airbnb JavaScript Style Guide](https://airbnb.io/javascript/#arrays--literals)
