---
title: "unicorn/require-array-join-separator"
description: "Require the separator argument of `Array#join()`"
# Generated by src/codegen/lint-rule-docs.ts. Do not edit below this line.
plugin: "unicorn"
aliases: []
kind: "suggestion"
category: "style"
default: "off"
fixable: "yes"
typeAware: false
deprecated: false
---

Without an argument, `join()` puts a comma between the items. A reader might expect no separator at all, or a comma and a space. Writing the separator out removes the guesswork.

The rule only looks at the method name, so it reports `.join()` without arguments on any object. It also reports `Array.prototype.join.call(items)` and `[].join.call(items)`.

`--fix` adds `","`, which keeps the result the same.

{/* 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]
"unicorn/require-array-join-separator" = "error" # or "warn"
```

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

## Examples

Reported:

{/* bad {"count": 2} */}
```js
const header = columns.join();
const names = Array.prototype.join.call(arguments);
```

Not reported:

{/* good */}
```js
const header = columns.join(",");
const names = Array.prototype.join.call(arguments, ", ");
const word = letters.join("");
```
