Files
wehub-resource-sync dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:55:53 +08:00

1.1 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
69738771fb5a7b8b24cca2a3 Challenge 177: String Mirror 28 challenge-177

--description--

Given a string, return a new string that consists of the given string with a reversed copy of itself appended to the end of it.

--hints--

mirror("freeCodeCamp") should return "freeCodeCamppmaCedoCeerf".

assert.equal(mirror("freeCodeCamp"), "freeCodeCamppmaCedoCeerf");

mirror("RaceCar") should return "RaceCarraCecaR".

assert.equal(mirror("RaceCar"), "RaceCarraCecaR");

mirror("helloworld") should return "helloworlddlrowolleh".

assert.equal(mirror("helloworld"), "helloworlddlrowolleh");

mirror("The quick brown fox...") should return "The quick brown fox......xof nworb kciuq ehT".

assert.equal(mirror("The quick brown fox..."), "The quick brown fox......xof nworb kciuq ehT");

--seed--

--seed-contents--

function mirror(str) {

  return str;
}

--solutions--

function mirror(str) {
  const reversed = str.split("").reverse().join("");
  return str + reversed;
}