Share Coding

Tutorials, Problems, Stuffs …

How to Print a to z easily on Javascript

It is easy to print a-z by using a for loop.

var first = "a", last = "z";
for(var i = first.charCodeAt(0); i <= last.charCodeAt(0); i++) {
	document.write( eval("String.fromCharCode(" + i + ")") + " " );
}

 
Result:

a b c d e f g h i j k l m n o p q r s t u v w x y z 
Advertisements

One response to “How to Print a to z easily on Javascript

  1. Akshay 2013/07/15 at 7:56 pm

    Thank you !! Looking for it 🙂

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: