freeCodeCamp/curriculum/challenges/chinese/02-javascript-algorithms-an.../basic-algorithm-scripting/reverse-a-string.md

928 B

id title challengeType videoUrl
a202eed8fc186c8434cb6d61 反转字符串 5

--description--

反转提供的字符串。您可能需要先将字符串转换为数组,然后才能将其反转。您的结果必须是字符串。如果卡住,请记得使用Read-Search-Ask 。编写自己的代码。

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

--solutions--