# oxc/bad-array-method-on-arguments

> Disallow calling array methods on the `arguments` object

`arguments` looks like an array because it has a `length` and numbered items. It isn't one, so it doesn't have `map`, `filter`, `join` or `slice`. Calling one of them throws `TypeError: arguments.map is not a function`.

Use a rest parameter, which is a real array, or copy `arguments` into an array first.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

Off by default. To turn it on:

```toml bunfig.toml
[lint.rules]
"oxc/bad-array-method-on-arguments" = "error" # or "warn"
```

{/* End of the generated section. */}

## Examples

Reported:

{/* bad */}
```js
function total() {
  return arguments.reduce((sum, price) => sum + price, 0);
}
```

Not reported:

{/* good */}
```js
function total(...prices) {
  return prices.reduce((sum, price) => sum + price, 0);
}

function legacyTotal() {
  return Array.from(arguments).reduce((sum, price) => sum + price, 0);
}
```
