concat

  • function
can.List.prototype.concat  

Merge many collections together into a List.

list.concat(...args)

Parameters

  1. args {Array | can.List | *}

    Any number of arrays, Lists, or values to add in For each parameter given, if it is an Array or a List, each of its elements will be added to the end of the concatenated List. Otherwise, the parameter itself will be added.

concat makes a new List with the elements of the List followed by the elements of the parameters.

var list = new can.List();
var newList = list.concat(
    'Alice',
    ['Bob', 'Charlie']),
    new can.List(['Daniel', 'Eve']),
    {f: 'Francis'}
);
newList.attr(); // ['Alice', 'Bob', 'Charlie', 'Daniel', 'Eve', {f: 'Francis'}]