true
if a
and b
have the same elements in the same order, false
otherwise
const a = [1, 2, 3];
const b = [1, 2, 3];
identical(a, b); // true
Check if 2 Set
s have the same elements.
Strict equality (===
) is used to compare elements.
Time complexity: O(n)
Space complexity: O(1)
true
if a
and b
have the same elements, false
otherwise
const a = new Set([1, 2, 3]);
const b = new Set([3, 2, 1]);
identical(a, b); // true
Check if 2 Map
s have the same key-value pairs.
Strict equality (===
) is used to compare values.
Time complexity: O(n)
Space complexity: O(1)
true
if a
and b
have the key-value pairs, false
otherwise
const a = new Map([['a', 1]]);
const b = new Map([['a', 1]]);
identical(a, b); // true
Check if 2 arrays have the same elements in the same order. Strict equality (
===
) is used to compare elements.Time complexity: O(n)
Space complexity: O(1)