Facebook Pixel

Acronym Generator

React.js
easy
15 mins

An acronym is formed by taking the first letter of each word, converting it to uppercase, and joining them together. This is useful in text shortening, branding (NASA, HTML, etc.), or fun abbreviation generators.

Things to do

  • Create an input where the user can type a phrase. Implement a function that:
  • Splits the phrase into words.
  • Takes the first letter of each word.
  • Converts it to uppercase.
  • Joins the letters together to form the acronym.

Add a button to generate the acronym

Display the result as :

Result : CSS // For Cascading Style Sheet as Input

Examples

input: "National Aeronautics Space Administration" output: "NASA"
input: " Hyper Text Markup Language " output: "HTML"
input: "" output: ""

Testing Instructions

Please use the following data-testid attributes in your React component:

  • input → for the input field
  • generate-button → for the button
  • result → for displaying the acronym result
Preview what you need to build

Companies:

tcs
wipro
cognizant
infosys

Solve Similar questions 🔥

Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.