Skip to content

Map Names to Team Designations #6

@CodelineAtyab

Description

@CodelineAtyab

User Story: Map Names to Team Designations

Title

As a team organizer, I want to transform a list of names by appending team designations based on the first letter of each name so that I can quickly categorize people into teams.

Acceptance Criteria

  • A JavaScript function should use the .map() method to process an array of names
  • For each name, the function should append "[Team X]" where X is the uppercase first letter of the name
  • The original name should be preserved in its original case
  • The function should handle empty strings gracefully
  • The transformed list should be displayed on the console
  • The function should work with names starting with any alphabetical character
  • The code should include appropriate comments explaining the map operation
  • The implementation should follow modern JavaScript conventions

Example Input and Output

Example: Team Designation Mapper

Input:

const names = ["john", "mary", "alex", "sarah", "tom"];
names.map(() => {}) // ????

Output:

[
  "john [Team J]",
  "mary [Team M]",
  "alex [Team A]",
  "sarah [Team S]",
  "tom [Team T]"
]

This example demonstrates how to use the .map() function to transform each name in the array by appending a team designation based on the first letter of the name. The original case of the name is preserved while the team designation uses the uppercase first letter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions