Files

1.0 KiB

id, title, challengeType, forumTopicId, dashedName
id title challengeType forumTopicId dashedName
a202eed8fc186c8434cb6d61 Inverter uma string 5 16043 reverse-a-string

--description--

Inverta a string fornecida.

Você pode ter que transformar a string em um array antes de poder inverter.

Seu resultado deve ser uma string.

--hints--

reverseString("hello") deve retornar uma string.

assert(typeof reverseString('hello') === 'string');

reverseString("hello") deve retornar a string olleh.

assert(reverseString('hello') === 'olleh');

reverseString("Howdy") deve retornar a string ydwoH.

assert(reverseString('Howdy') === 'ydwoH');

reverseString("Greetings from Earth") deve retornar a string htraE morf sgniteerG.

assert(reverseString('Greetings from Earth') === 'htraE morf sgniteerG');

--seed--

--seed-contents--

function reverseString(str) {
  return str;
}

reverseString("hello");

--solutions--

function reverseString(str) {
  return str.split('').reverse().join('');
}

reverseString("hello");