- 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 3 Draft / May 29, 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 skippedElements.
- If toSkip < -0𝔽, then
- Let error be ThrowCompletion(a newly created RangeError object).
- Return ? IteratorClose(iterated, error).
- If toSkip is finite and toSkip > 𝔽(253 - 1), 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)).