• Check if 2 or more iterables hold the same elements. Strict equality (===) is used to compare elements.

    Time complexity: O(n) where n is the number of elements in the iterables

    Space complexity: O(n)

    Type Parameters

    • T

    Parameters

    • Rest...iterables: readonly [Iterable<T>, Iterable<T>, Iterable<T>]

      Elements to compare

    Returns boolean

    true if all elements are strictly equal, false otherwise

    const a = [1, 2, 3];
    const b = [1, 2, 3];
    const c = [1, 2, 3];
    const d = [1, 2, 3];
    const e = [1, 2, 3];

    same(a, b, c, d, e); // true