The passed in target array
let theArray = arrAppend([], 1);
arrAppend(theArray, [ 2, 3, 4 ]);
arrAppend(theArray, [ "a", "b", "c" ]);
// theArray is now [ 1, 2, 3, 4, "a", "b", "c" ]
// Adding a single value
arrAppend([], undefined); // []
arrAppend([], 0); // [ 0 ]
arrAppend([1], undefined); // [ 1 ]
arrAppend([1], 2); // [ 1, 2 ]
// Adding an array
arrAppend([], [] as number[]); // []
arrAppend([], [0]); // [ 0 ]
arrAppend([1], []); // [ 1 ]
arrAppend([1], [2]); // [ 1, 2 ]
// Adding with an iterator
arrAppend([], ([] as number[]).values()); // []
arrAppend([], [0].values()); // [ 0 ]
arrAppend([1], [].keys()); // [ 1 ]
arrAppend([1], [2].values()); // [ 1, 2 ]
arrAppend([1], [2].keys()); // [ 1, 0 ] - 0 is from the index from the first element
Appends the
elms
to thetarget
where the elms may be an array, a single object or an iterator object