Files
2022-11-25 15:18:14 +01:00

1.0 KiB

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

--description--

Inverta a string fornecida e retorne-a com a inversão.

Por exemplo, "hello" deve se tornar "olleh".

--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");