Objects & Immutability

Compute Object Difference

mediumJS SpecificJS / TS3 tests

Problem Statement

Implement `objectDiff(obj1, obj2)` that returns an object containing only the keys where values in `obj2` differ from `obj1`, added keys, and removed keys (marked as undefined).

Examples

Example 1:
objectDiff({ a: 1, b: 2 }, { a: 1, b: 3, c: 4 });
// { b: 3, c: 4 }
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.