Leaderboard Archive
Javascript Apr 11, 2026

What is the output?

const x = [1, 2, 3]
const y = x
y.push(4)
console.log(x.length)
A 3
B 4
C undefined
D TypeError
Explanation
Arrays are reference types. y = x does not copy — both point to the same array in memory.
📝
Reviewed by CodeShot Editorial
Every challenge is code-reviewed by senior developers to ensure accuracy and real-world relevance. Learn more.

Ready for your shot?

Join thousands of developers solving one logic puzzle every morning.

Solve Today's Challenge →