Sera Systems interview question

How to loop through an object and flatten any arrays found.