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

push

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

Returns a new sequence with the same elements as this one, plus the specified element at the end.

Signature

ArrayLikeSequence.push = function() { /*...*/ }
ArrayLikeSequence.push = function push(value) {
  return this.concat([value]);
}
NameType(s)Description
returnsArrayLikeSequence

The new array-like sequence.

Examples

Lazy([1, 2]).push(3) // sequence: [1, 2, 3]
Lazy([]).push(1)     // sequence: [1]