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

x/arrays/mod.ts>Arrays.diff

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

Returns the unique elements in an array compared to the rest of the arrays (args).

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

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

const diffArr = arr1.diff(arr2, arr3, arr4)
// => [1]

Parameters

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

Returns

Array<any>