Pregunta de entrevista de WhiteHat Jr

Coding in Javascript with medium level of difficulty.