get
优质
小牛编辑
130浏览
2023-12-01
Returns the element at the specified index. Note that, for sequences that are not ArrayLikeSequences, this may require partially evaluating the sequence, iterating to reach the result. (In other words for such sequences this method is not O(1).)
Signature
Sequence.get = function(i) { /*...*/ }
Sequence.get = function get(i) { var element; this.each(function(e, index) { if (index === i) { element = e; return false; } }); return element; }
Name | Type(s) | Description |
---|---|---|
i | number | The index to access. |
returns | * | The element. |