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.3 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
69c5f3d787b1725d5f00c8b8 Challenge 254: Odd Words 28 challenge-254

--description--

Given a string of words, return only the words with an odd number of letters.

  • Words in the given string will be separated by a single space.
  • Return the words separated by a single space.

--hints--

getOddWords("This is a super good test") should return "a super".

assert.equal(getOddWords("This is a super good test"), "a super");

getOddWords("one two three four") should return "one two three".

assert.equal(getOddWords("one two three four"), "one two three");

getOddWords("banana split sundae with rainbow sprinkles on top") should return "split rainbow sprinkles top".

assert.equal(getOddWords("banana split sundae with rainbow sprinkles on top"), "split rainbow sprinkles top");

getOddWords("The quick brown fox jumped over the lazy river") should return "The quick brown fox the river".

assert.equal(getOddWords("The quick brown fox jumped over the lazy river"), "The quick brown fox the river");

--seed--

--seed-contents--

function getOddWords(str) {

  return str;
}

--solutions--

function getOddWords(str) {
  return str
    .split(" ")
    .filter(word => word.length % 2 === 1)
    .join(" ");
}