The ===
operator in JavaScript checks for strict equality, meaning it compares both the value and the type of the operands. When applied to arrays, ===
checks if both arrays reference the exact same memory location (i.e., they are the same object).
Two arrays with identical contents but stored in different memory locations will not be considered equal.
const array1 = [1, 2, 3];
const array2 = [1, 2, 3];
console.log(array1 === array2); // false (different memory references)
const array3 = array1;
console.log(array1 === array3); // true (same memory reference)