Loop A to Z
JavaScript
easy
5 mins
Write a function generateAtoZ() that returns an array of 26 strings representing the letters A through Z in order.
Examples
Input: none Output: ["A", "B", "C", ..., "Z"]
Constraints
- Use a loop-based approach (e.g., for or while).
- Output must be an array of exactly 26 single-character uppercase strings.
- No input arguments are required.
Function Signature
function generateAtoZ() { // Your code here }
Test Cases
- Returns an array
- Length is 26
- First element is "A", last element is "Z"
- All elements are single uppercase letters -Letters are strictly in ascending order without duplicates
Companies:
Accenture
tcs
infosys
capgemini
wipro
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!
