JavaScript Interview Question: Object Keys and Type Coercion

I recently faced a JavaScript interview, and the interviewer asked a small question that confused many candidates 🧠 let a = {} let b = { key: "b" } let c = { key: "c" } a[b] = 123 a[c] = 456 console.log(a[b]) The interviewer asked: “What will be the output?” Looks simple. But it tests a deep JavaScript concept. 🧠 What they were really testing: • How JavaScript handles object keys • Type coercion in objects • Understanding of implicit string conversion Many developers assume that different objects create different keys. But JavaScript behaves differently. 🚀 Sometimes interviews are not about complex code. They are about understanding the language deeply. #JavaScript #FrontendInterview #MERNStack #WebDevelopment #CodingInterview #ProblemSolving #JavaScriptConcepts

To view or add a comment, sign in

Explore content categories