// Create an empty array to store the alphabet
const alphabetArray = [];
// Use a for loop to iterate through ASCII values of uppercase letters ('A' to 'Z')
for (let i = 65; i <= 90; i++) {
// Convert the ASCII value to its corresponding character and push it to the array
alphabetArray.push(String.fromCharCode(i));
}
// Display the resulting array in the console
console.log(alphabetArray);
No comments:
Post a Comment