Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/arrays/mod.ts>Arrays.merge

Provides utility methods for common Array operations
Latest
function Arrays.merge
import { Arrays } from "https://deno.land/x/arrays@v1.0.21/mod.ts";
const { merge } = Arrays;

Merge the elements from the rest of the arrays (args) to the first array. A nested array will be considered as a single value.

import 'https://deno.land/x/arrays/mod.ts'

const arr1 = [1, 2, 3, 4]
const arr2 = ['dog', 'cat']
const arr3 = [1.1, 2.2, 3.3]
const arr4 = [[ 'cheetah', 'rhino' ], 'monkey']

const mergedArr = arr1.merge(arr2, arr3, arr4)
// => [1, 2, 3, 4, 'dog', 'cat', 1.1, 2.2, 3.3, ['cheetah', 'rhino'], 'monkey']

Parameters

array: Array<any>
  • Rest of the arrays
...args: any

Returns

Array<any>