- Toggle shortcuts help
?
- Toggle "can call user code" annotations
u
- Jump to search box
/
- Toggle pinning of the current clause
p
- Jump to the nth pin
1-9
- Jump to the 10th pin
0
- Jump to the most recent link target
`
Stage 2.7 Draft / March 12, 2026
Iterator Includes
1 Iterator.prototype.includes ( searchElement [ , skippedElements ] )
- Let O be the this value.
- If O is not an Object, throw a TypeError exception.
- Let iterated be the Iterator Record { [[Iterator]]: O, [[NextMethod]]: undefined, [[Done]]: false }.
- If skippedElements is undefined, then
- Let toSkip be 0.
- Else,
- If skippedElements is not one of +∞𝔽, -∞𝔽, or an integral Number, then
- Let error be ThrowCompletion(a newly created TypeError object).
- Return ? IteratorClose(iterated, error).
- Let toSkip be the extended mathematical value of skippedElements.
- If toSkip < 0, then
- Let error be ThrowCompletion(a newly created RangeError object).
- Return ? IteratorClose(iterated, error).
- Let skipped be 0.
- Set iterated to ? GetIteratorDirect(O).
- Repeat,
- Let value be ? IteratorStepValue(iterated).
- If value is done, return false.
- If skipped < toSkip, then
- Set skipped to skipped + 1.
- Else if SameValueZero(value, searchElement) is true, then
- Return ? IteratorClose(iterated, NormalCompletion(true)).