repl.txt (1213B)
1 2 {{alias}}( collection, ...items ) 3 Adds one or more elements to the end of a collection. 4 5 If the input collection is a typed array, the output value does not equal 6 the input reference and the underlying `ArrayBuffer` may *not* be the same 7 as the `ArrayBuffer` belonging to the input view. 8 9 For purposes of generality, always treat the output collection as distinct 10 from the input collection. 11 12 Parameters 13 ---------- 14 collection: Array|TypedArray|Object 15 A collection. If the collection is an `Object`, the collection should be 16 array-like. 17 18 items: ...any 19 Items to add. 20 21 Returns 22 ------- 23 out: Array|TypedArray|Object 24 Updated collection. 25 26 Examples 27 -------- 28 // Arrays: 29 > var arr = [ 1.0, 2.0, 3.0, 4.0, 5.0 ]; 30 > arr = {{alias}}( arr, 6.0, 7.0 ) 31 [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ] 32 33 // Typed arrays: 34 > arr = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0 ] ); 35 > arr = {{alias}}( arr, 3.0, 4.0 ) 36 <Float64Array>[ 1.0, 2.0, 3.0, 4.0 ] 37 38 // Array-like object: 39 > arr = { 'length': 0 }; 40 > arr = {{alias}}( arr, 1.0, 2.0 ) 41 { 'length': 2, '0': 1.0, '1': 2.0 } 42 43 See Also 44 -------- 45