Skip to content

eles.toArray()

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

eles.toArray — Collection › Iteration and aggregation

Preview · Collection › Iteration and aggregation

Read in the complete API reference · All API members

// The elements as a plain array of length-1 collections
eles.toArray(): Collection<NodeData, EdgeData, Data>[]

The elements as a plain array of length-1 collections.

Returns Collection<NodeData, EdgeData, Data>[]

a new array of the members

Example

console.log(eles.toArray().map(ele => ele.id())); // ['a', 'b', 'c', 'ab', 'bc']

Example graph and handle setup