Skip to content

eles.last()

eles.last — Collection > Iteration and aggregation. Cytoscape.js signatures, parameters and return contract.

eles.last — Collection › Iteration and aggregation

Preview · Collection › Iteration and aggregation

Read in the complete API reference · All API members

// The last element, as a length-1 collection
eles.last(): Collection<NodeData, EdgeData, Data>

The last element, as a length-1 collection.

Returns Collection<NodeData, EdgeData, Data>

the last element, or an empty collection

Example

console.log(eles.last().map(ele => ele.id())); // ["bc"]

Example graph and handle setup