• Parameters

    • array: any[]

      an array of any type.

    Returns any[]

    the same input array but filtered to remove elements which appear only once.

    Description

    Given an array of any type, return a copy of the same array but filter out any items which only appear once. The comparison uses conversion-to-string, then matching to compare, so this works for primitives (bool, number, string), not objects or arrays.

    Example

    [1,2,3,2,1] will result in [1,2,2,1]