JavaScript Interview Question: Arrays and Objects by Reference

JavaScript Interview Question (Confusing but Important 🤯) What will be the output? console.log([] == []); console.log([] === []); console.log({} == {}); console.log({} === {}); 👉 Answer: All will be false Why? Arrays and objects in JavaScript are stored in memory by reference, not by value. Each [] or {} creates a new object with a different memory address, and JavaScript compares references — not structure or content. Same shape ≠ same reference 📌 This is one of the most common JavaScript interview traps. #JavaScript #InterviewQuestions #WebDevelopment #Frontend #Backend #CodingTips

To view or add a comment, sign in

Explore content categories