Example 1 — Official Sample
Put three letters at index 2, as in the Ramda docs.
const result = R.insertAll(2, ['x', 'y', 'z'], [1, 2, 3, 4]);
console.log(JSON.stringify(result)); // [1,2,"x","y","z",3,4] How It Works
- Argument order. Index first, items array second, list last.
- Position 2. The item at index 2 is
3, so the letters go just before it. - Order kept.
'x','y','z'appear in the same order as in the array. - Shift.
3and4move right; the result has 7 items.
