javascript

Print Alphabets A to Z & a to z using pure JavaScript!

In this post, we are going to write a pure JavaScript program to print alphabets from A to Z and a to z.

To print Alphabets in JavaScript is pretty simple, for example, the below code will print “A”

So, the value 65 is A, the same way to print B, we need to pass the value of 66 and so on. Therefore, to print A to Z, all we have to do is to pass the value from 65 to 91. And, for small letters, it will be 97 to 123.

Let’s write a function for that,

Now, when you call the function printAlphabets(), you can see A to Z printed on your console. For small letters, you need to call printAlphabets(‘small’)

Let’s write a simple HTML page and print the values, also i will put the demo link at the bottom of this page.

Copy this example and put it in a file then save it as .html and then open in browser to execute the complete code.

You can see the demo here:

demo

Related Posts

Leave a Reply