Version: v0.5.1 - Beta.  We welcome contributors & feedback.  THanks!

List.insertAll

insertAll(list, index)

Description

Insert multiple elements into a List.

If index is positive, it inserts before that position.
If index is negative, it inserts after that position, counting from the end.

To add the elements to the end of a List, use pushAll.

let list1 = ['a', 'b'];
let list2 = ['X', 'Y'];

list1.insertAll(list2, 0);
//= ['X', 'Y', 'a', 'b']

list1.insertAll(list2, -2);
//= ['a', 'X', 'Y', 'b']

See Also