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

rest

优质
小牛编辑
127浏览
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);
}
NameType(s)Description
countnumber?

The number of items to omit from the beginning of the sequence (defaults to 1).

returnsSequence

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: []