Implement a function compact(obj) that takes an object and returns a new object with all falsey values (false, 0, "", null, undefined, and NaN) removed.
The function should:
Example
compact({ a: 0, b: 1, c: false, d: "", e: null, f: { x: undefined, y: 2 }, g: [0, 3, null] }); // { b: 1, f: { y: 2 }, g: [3] }
JavaScript Function
No test results yet
Click "Run" to execute tests