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
69bc6cb30c1d112a2e110a03 Challenge 246: Name Initials 28 challenge-246

--description--

Given a full name as a string, return their initials.

  • Names to initialize are separated by a space.
  • Initials should be made uppercase.
  • Initials should be separated by dots.

For example, "Tommy Millwood" returns "T.M.".

--hints--

getInitials("Tommy Millwood") should return "T.M.".

assert.equal(getInitials("Tommy Millwood"), "T.M.");

getInitials("Savanna Puddlesplash") should return "S.P.".

assert.equal(getInitials("Savanna Puddlesplash"), "S.P.");

getInitials("Frances Cowell Conrad") should return "F.C.C.".

assert.equal(getInitials("Frances Cowell Conrad"), "F.C.C.");

getInitials("Dragon") should return "D.".

assert.equal(getInitials("Dragon"), "D.");

getInitials("Dorothy Vera Clump Haverstock Norris") should return "D.V.C.H.N.".

assert.equal(getInitials("Dorothy Vera Clump Haverstock Norris"), "D.V.C.H.N.");

--seed--

--seed-contents--

function getInitials(name) {

  return name;
}

--solutions--

function getInitials(name) {
  return name.split(' ').map(word => word[0].toUpperCase() + '.').join('');
}