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)
Rest
Elements to compare
true if all elements are strictly equal, false otherwise
true
false
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 Copy
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
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)