Files
freecodecamp--freecodecamp/curriculum/challenges/english/blocks/daily-coding-challenges-javascript/69c5f3d787b1725d5f00c8b7.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

2.0 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
69c5f3d787b1725d5f00c8b7 Challenge 253: Acronym Finder 28 challenge-253

--description--

Given a string representing an acronym, return the full name of the organization it belongs to from the list below:

  • "National Avocado Storage Authority"
  • "Cats Infiltration Agency"
  • "Fluffy Beanbag Inspectors"
  • "Department Of Jelly"
  • "Wild Honey Organization"
  • "Eating Pancakes Administration"

Each letter in the given acronym should match the first letter of each word in the organization it belongs to, in the same order.

--hints--

findOrg("NASA") should return "National Avocado Storage Authority".

assert.equal(findOrg("NASA"), "National Avocado Storage Authority");

findOrg("CIA") should return "Cats Infiltration Agency".

assert.equal(findOrg("CIA"), "Cats Infiltration Agency");

findOrg("FBI") should return "Fluffy Beanbag Inspectors".

assert.equal(findOrg("FBI"), "Fluffy Beanbag Inspectors");

findOrg("DOJ") should return "Department Of Jelly".

assert.equal(findOrg("DOJ"), "Department Of Jelly");

findOrg("WHO") should return "Wild Honey Organization".

assert.equal(findOrg("WHO"), "Wild Honey Organization");

findOrg("EPA") should return "Eating Pancakes Administration".

assert.equal(findOrg("EPA"), "Eating Pancakes Administration");

--seed--

--seed-contents--

function findOrg(acronym) {

  return acronym;
}

--solutions--

function findOrg(acronym) {
  const orgs = [
    "National Avocado Storage Authority",
    "Cats Infiltration Agency",
    "Fluffy Beanbag Inspectors",
    "Department Of Jelly",
    "Wild Honey Organization",
    "Eating Pancakes Administration"
  ];

  for (let org of orgs) {
    const initials = org
      .split(" ")
      .map(word => word[0])
      .join("");

    if (initials.toUpperCase() === acronym.toUpperCase()) {
      return org;
    }
  }

  return "not found";
}