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

length

优质
小牛编辑
135浏览
2023-12-01

Returns the length of the sequence.

Signature

ArrayLikeSequence.length = function() { /*...*/ }
ArrayLikeSequence.length = function length() {
  return this.parent.length();
}
NameType(s)Description
returnsnumber

The length.

Examples

function increment(x) { return x + 1; }

Lazy([]).length()                       // => 0
Lazy([1, 2, 3]).length()                // => 3
Lazy([1, 2, 3]).map(increment).length() // => 3