Example 1 — Official Sample
Put 'a' between four letters, as in the Ramda docs, then join them.
const letters = R.intersperse('a', ['b', 'n', 'n', 's']);
console.log(JSON.stringify(letters)); // ["b","a","n","a","n","a","s"]
console.log(R.join('', letters)); // bananas How It Works
- Argument order. Separator first, list last.
- Gaps. Four letters have three gaps, so
'a'is added three times. - Still an array. The result has 7 items; nothing is added at either end.
- Join.
R.join('')glues the letters intobananas.
