Files
2022-12-01 01:15:49 +09:00

991 B

id, title, challengeType, forumTopicId, dashedName
id title challengeType forumTopicId dashedName
a202eed8fc186c8434cb6d61 反转字符串 1 16043 reverse-a-string

--description--

反转提供的字符串并返回反转后的字符串。

例如, "hello" 应该变成 "olleh"

--hints--

reverseString("hello") 应返回一个字符串。

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

reverseString("hello") 应返回 olleh

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

reverseString("Howdy") 应返回 ydwoH

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

reverseString("Greetings from Earth") 应返回 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");