employer cover photo
employer logo

Pergunta de entrevista da empresa Opower

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

Resposta da entrevista

Sigiloso

20 de jun. de 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)