Blurred employer
Cover image for Meta
See All Photos


Engaged Employer


Add an Interview

Interview Question

Front End Engineer Interview



Flatten Array, Create Emitter

Interview Answers

2 Answers


Shortest way to flatten an array I could come up with: function flatten(a) { return Array.isArray(a) ? [].concat( : a; }

Anonymous on


to flatten nested arrays : const flatten = array => { return array.reduce((elem, acc) => { return elem.concat(Array.isArray(acc) ? flatten(acc) : acc); }, []); }

Sonia on

Add Answers or Comments

To comment on this, Sign In or Sign Up.

Meta Careers

Cover image for Meta

Bring the world closer together with Meta Meta builds technologies that help people connect, find communities and grow businesses. When...More

  • Our Technologies
  • The Metaverse
  • Meta and You
This is the employer's chance to tell you why you should work for them. The information provided is from their perspective.