slice
can.List.prototype.slice
Make a copy of a part of a List.
list.slice([start[, end]])
slice
creates a copy of a portion of the List.
Parameters
-
start
=0
{Number}
Optionalthe index to start copying from
-
end
{Number}
Optionalthe first index not to include in the copy If end is not supplied,
slice
will copy until the end of the list.
Returns
{can.List}
a new can.List
with the extracted elements
slice
is the simplest way to copy a List: