employer cover photo
employer logo

Pregunta de entrevista de Opower

Write a function that accepts a single argument that returns a flattened array regardless of what argument type was passed in.

Respuesta de la entrevista

Anónimo

20 jun 2015

It was ultimately a recursive function the guy wanted me to write which I finally wrote after prodding a bit to gain clarity on the question (it wasnt as simple as I wrote it above) and working through his pseudo code of expectations (should I accommodate passing in an undefined value? should I allow non-array elements? etc)