DEV Community

Discussion on: Interview Qs Decoded - # 2

Collapse
 
gerbosan profile image
Carlos A.

XD
Is so cool to read so many possibilities and some are quite elegant. Though it is kind of a simple example, as you have mentioned, the goal is to show your communication skills and your language knowledge.

const testText = "Please, reverse me!";
const reverseFunction = text => {
  const arrayText = Array.from(text)
  const reversedText = [];
  arrayText.forEach(elem => {
    reversedText.unshift(elem)
  });
  return reversedText.join('');
}

Here's what came to my mind. Though, I wonder about the JS version, could that be a valid question? Don't forget to review and clean your code. Finally, don't stay quiet while developing, speak your thought process, so your interviewer can follow you.

Again, thank you for the chance. =)