Files
2022-11-28 17:00:52 +01:00

1.0 KiB

id, title, challengeType, forumTopicId, dashedName
id title challengeType forumTopicId dashedName
a202eed8fc186c8434cb6d61 Invertire una stringa 1 16043 reverse-a-string

--description--

Inverti la stringa fornita e restituisci la stringa invertita.

Ad esempio, "hello" dovrebbe diventare "olleh".

--hints--

reverseString("hello") dovrebbe restituire una stringa.

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

reverseString("hello") dovrebbe restituire la stringa olleh.

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

reverseString("Howdy") dovrebbe restituire la stringa ydwoH.

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

reverseString("Greetings from Earth") dovrebbe restituire la stringa 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");