Q. What will be the result of the following code snippet?
Code:let x = [1, 2, 3]; let y = x; y.push(4); console.log(x);
β
Correct Answer: (B)
[1, 2, 3, 4]
Explanation: Arrays are reference types in JavaScript. When `y` is assigned to `x`, they both reference the same array. Modifying `y` also affects `x`, so `x` becomes `[1, 2, 3, 4]`.