get
优质
小牛编辑
160浏览
2023-12-01
Returns the element at the specified index.
Signature
ArrayLikeSequence.get = function(i) { /*...*/ }
ArrayLikeSequence.get = function get(i) { return this.parent.get(i); }
Name | Type(s) | Description |
---|---|---|
i | number | The index to access. |
returns | * | The element. |
Examples
function increment(x) { return x + 1; } Lazy([1, 2, 3]).get(1) // => 2 Lazy([1, 2, 3]).get(-1) // => undefined Lazy([1, 2, 3]).map(increment).get(1) // => 3