Loading TOC...

Sequence.prototype.@@iterator

Sequence.prototype.@@iterator() as Object

Summary

Return an iterator object. A Sequence is flattened when iterated through. Advancing the returned iterator does not side-effect the Sequence.

Example

const docs = fn.doc();
const i = 0;
for (const doc of docs) i++;
for (const doc of docs) i++;
i;

// Returns 2 * the number of documents

Example

const s = Sequence.from("javascript", x=>x.toUpperCase());
const it = s[Symbol.iterator]();
[s, it.next().value];

// Returns: [["J", "A", "V", "A", "S", "C", "R", "I", "P", "T"], "J"]

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.