🚨 “Why did my JavaScript object suddenly break?” I remember thinking: “Object keys are just variable names… easy.” That single assumption cost me hours of debugging 😵💫 Most beginners don’t realize this early: 👉 JavaScript does not treat object keys the way we visually see them. Internally, every object key is stored as a string 🧠 So when a key contains: • spaces • special characters JavaScript needs it to be written explicitly as a string. If you skip this rule, the code: • throws errors • behaves unexpectedly • makes objects feel “random” They’re not random. Your mental model is incomplete. 📌 One tiny syntax rule = hours of confusion saved #JavaScript #LearningInPublic #WebDevelopment #FrontendDevelopment #Debugging
what about using the camelCase approach i think its better instead "home address" store as homeAddress no need to warp in string much more intuitive. What's your take?
Fahad Bhatti but You cannot access it using dot notation. Taking this approach allows you access to keys only with Bracket notation. Also i dont think this is Valid identifier in JS. But yes we do have certain cases where we explicit have spaces in keys.