Travis build: 1795

This commit is contained in:
30secondsofcode
2020-03-05 21:10:09 +00:00
parent a9c58a0b95
commit 6ae9cd2fcb
13 changed files with 125 additions and 127 deletions

View File

@@ -11,14 +11,15 @@ Omit the second argument, `separator`, to use a default separator of `','`.
Omit the third argument, `end`, to use the same value as `separator` by default.
```js
const join = (arr, separator = ',', end = separator) =>
arr.reduce(
(acc, val, i) =>
i === arr.length - 2
? acc + val + end
: i === arr.length - 1
? acc + val
: acc + val + separator,
? acc + val
: acc + val + separator,
''
);
```