Sequence.prototype.@@iterator() as Object
Return an iterator object. A Sequence is flattened when iterated through. Advancing the returned iterator does not side-effect the Sequence.
const docs = fn.doc(); let i = 0; for (const doc of docs) i++; for (const doc of docs) i++; i; // Returns 2 * the number of documents
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: Get the most useful answers to questions from the MarkLogic community, or ask your own question.