目录
当前位置: 首页 > 文档资料 > Lazy.js 英文文档 >

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;
}
NameType(s)Description
inumber

The index to access.

returns*

The element.