WARNING: The [sjs-3] engine was deprecated, use [sjs-4] instead.


Return a new collection having a range of the original.


collection.slice(from int) Collection collection.slice(from int, to int) Collection


from int

Starting index, inclusive

to int

Ending index, exclusive. So if ending index is 3, only files up to index 2 will be included in the new collection.


Return a new collection having files between a starting and ending index or the original collection. Negative indexes mean distance from the end of the collection.

Note that the starting index is inclusive, the ending index is exclusive. If you are a mathematician, let’s just say it returns the range [from, to[.


Creating an empty slice, original is unchanged.

Slicing a range.

Only providing a starting index.

Using negative indexes.

Last 2 files of the collection using negative indexes.