1.3 KiB
1.3 KiB
id, title, challengeType, forumTopicId, dashedName
id | title | challengeType | forumTopicId | dashedName |
---|---|---|---|---|
a202eed8fc186c8434cb6d61 | Зворотний рядок | 5 | 16043 | reverse-a-string |
--description--
Переверніть заданий рядок.
За необхідності перетворіть рядок у масив до того, як вносити зміни.
У результаті ви повинні отримати рядок.
--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");