Skip to content
maxkfranz edited this page Mar 8, 2012 · 3 revisions

eles.slice()

Get a subset of the collection between two indices.

eles.slice( start )

Gets all elements including and after the specified index

start : The index of the first element to include in the returned collection

eles.slice( start, end )

Gets elements between two specified indices

start : The index of the first element to include in the returned collection
end : The index of the end of the slice; the element at this index is not included

Details

This function is useful for getting a "subarray" of the collection.

Examples

var allButFirstNode = cy.nodes().slice(1);
var secondAndThirdNode = cy.nodes().slice(1, 3); 

Clone this wiki locally