Objects & Immutability

Flatten Nested Object

mediumJS SpecificJS / TS3 tests

Problem Statement

Implement `flattenObject(obj)` that flattens a deeply nested object into a single-level object whose keys are dot-separated paths.

Examples

Example 1:
flattenObject({ a: 1, b: { c: 2, d: { e: 3 } } });
// { 'a': 1, 'b.c': 2, 'b.d.e': 3 }
JavaScript & TypeScript starter code included
Run this as a live interview

Practice solo

3 test cases. No second person needed.

Get new interview exercises

Practice problems and review drills, sent when we publish new ones. No spam.

Unsubscribe anytime. We never share your address.