Example 1 — Official Samples
Make a reusable space joiner, then join numbers with a pipe — both samples from the Ramda docs.
const spacer = R.join(' ');
console.log(spacer(['a', 2, 3.4])); // 'a 2 3.4'
console.log(R.join('|', [1, 2, 3])); // '1|2|3' How It Works
- Curried.
R.join(' ')has only the separator, so it returns a function calledspacer. - Mixed items.
spacerturns'a',2, and3.4into text and puts a space between them. - Both arguments.
R.join('|', [1, 2, 3])runs straight away and returns'1|2|3'. - Between only. Three items get two separators — nothing at the start or end.
