Pergunta de entrevista da empresa Palador

I was asked to write a jQuery function on how to manipulate a string of text.