freeCodeCamp/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/reverse-a-string.md
Randell Dawson 4696b47c01
chore(i8n,learn): processed translations (#41141)
Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
2021-02-16 14:21:30 -08:00

1.1 KiB

id title challengeType forumTopicId dashedName
a202eed8fc186c8434cb6d61 Invertir una Cadena 5 16043 reverse-a-string

--description--

Invertir la cadena provista.

Es posible que necesites convertir la cadena en una matriz antes de poder invertirla.

Tu resultado deber ser una cadena.

--hints--

reverseString("hello") debería devolver una cadena.

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

reverseString("hello") debería convertirse en "olleh".

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

reverseString("Howdy") debería convertirse en "ydwoH".

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

reverseString("Greetings from Earth") debería devolver "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");