Pergunta de entrevista da empresa WhiteHat Jr

Coding in Javascript with medium level of difficulty.