Birdeye interview question

Flatten an object in js