rest
优质
小牛编辑
140浏览
2023-12-01
Creates a new sequence comprising all but the first N elements of this sequence.
Signature
Sequence.rest = function(count) { /*...*/ }
Sequence.rest = function rest(count) { return new DropSequence(this, count); }
Name | Type(s) | Description |
---|---|---|
count | number? | The number of items to omit from the beginning of the sequence (defaults to 1). |
returns | Sequence | The new sequence. |
Examples
Lazy([1, 2, 3, 4]).rest() // sequence: [2, 3, 4] Lazy([1, 2, 3, 4]).rest(0) // sequence: [1, 2, 3, 4] Lazy([1, 2, 3, 4]).rest(2) // sequence: [3, 4] Lazy([1, 2, 3, 4]).rest(5) // sequence: []