React Interview Question: Flattening a Nested Object

Today, I appeared for an L1 interview for a React.js role. Sharing one of the questions here—it might help others who are preparing for similar frontend roles. 🔹 Question asked: Input: { name: "test", address: { personal: "abcd", office: { building: "efgh", street: "hijk", location: { landmark: "efgh", pin: "7888" } } } } Expected Output: { name: "test", personal: "abcd", building: "efgh", street: "hijk", landmark: "efgh", pin: "7888" } 👉 The goal was to flatten a deeply nested object into a single-level object using JavaScript. Interviews are a great reminder that strong fundamentals in JavaScript are just as important as framework knowledge. Hope this helps someone preparing for frontend interviews 🚀 #React #JavaScript #TypeScript #Redux #Frontend #InterviewExperience

To view or add a comment, sign in

Explore content categories