Pregunta de entrevista de Elastic

Flattening a Nested javascript object to an array structure.