Files
freecodecamp--freecodecamp/curriculum/challenges/english/blocks/daily-coding-challenges-javascript/6a2037a68a0bc2aef0006007.md
T
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.4 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
6a2037a68a0bc2aef0006007 Challenge 345: Word Blender 28 challenge-345

--description--

Given two words, return a new word by combining the first half of the first word with the second half of the second word.

  • For odd-length words, the first half is the shorter half.

--hints--

blendWords("turtle", "toucan") should return "turcan".

assert.equal(blendWords("turtle", "toucan"), "turcan");

blendWords("chipmunk", "flamingo") should return "chipingo".

assert.equal(blendWords("chipmunk", "flamingo"), "chipingo");

blendWords("falcon", "pelican") should return "falican".

assert.equal(blendWords("falcon", "pelican"), "falican");

blendWords("hyena", "iguana") should return "hyana".

assert.equal(blendWords("hyena", "iguana"), "hyana");

blendWords("scorpion", "gorilla") should return "scorilla".

assert.equal(blendWords("scorpion", "gorilla"), "scorilla");

blendWords("platypus", "wolverine") should return "platerine".

assert.equal(blendWords("platypus", "wolverine"), "platerine");

--seed--

--seed-contents--

function blendWords(word1, word2) {

  return word1;
}

--solutions--

function blendWords(word1, word2) {
  const firstHalf = word1.slice(0, Math.floor(word1.length / 2));
  const secondHalf = word2.slice(Math.floor(word2.length / 2));
  return firstHalf + secondHalf;
}