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 🔥
Want to upskill? Explore our courses!
Namaste DSA
Master DSA from scratch with numerous problems, and expert guidance.
Namaste React
Wanna dive deep into React and become Frontend Expert? Learn with me now!
Namaste Frontend System Design
The most comprehensive and detailed course for frontend system design.
Namaste Node.js
Wanna dive deep into Node.js? Enroll into `Namaste Node.js` now!
