Skip Navigation

JavaScript Cheat Sheet

The JavaScript cheat sheet is designed to act as a reminder and reference sheet, listing methods and functions of JavaScript. It includes reference material for regular expressions in JavaScript, as well as a short guide to the XMLHttpRequest object. A description of what is on the cheat sheet follows, or if you are impatient, you can go straight to the full size JavaScript cheat sheet.

Functions and Methods

Thumbnail highlighting functions and methods sections.JavaScript has a huge number of methods and functions available. The cheat sheet lists these in various sections. On the left is a list of simple methods in JavaScript. On the right are DOM methods. Functions are in their own section at the bottom of the page.

XMLHttpRequest

Thumbnail highlighting XMLHttpRequest area.The XMLHttpRequest object is relatively new to JavaScript. It is used to make requests and receive responses in XML format from a server, allowing developers to create interactivity with the server without the need for page refreshes (see the "Live Search" on the right of this page for an example). This section of the cheat sheet is a short reference to the object, containing a list of useful methods and properties, the syntax for creating the object in different browsers, and the various readyState values.

JavaScript in HTML

Thumbnail highlighting the JavaScript in HTML area. This section contains simple HTML, showing how to add JavaScript to an HTML document.

Regular Expressions

Thumbnail highlighting regular expressions section. JavaScript contains support for regular expressions. This section shows the format, modifiers and pattern syntax of regular expressions in JavaScript.

Event Handlers

Thumbnail highlighting event handlers list. Personally, I often forget the exact names of the various event handlers in JavaScript. This list contains all of the event handlers available in JavaScript.

Download

So now that you know what it does, please feel free to print out the JavaScript cheat sheet:

Please note: If you wish to link to the JavaScript cheat sheet from elsewhere, please link to this page so others find the description, rather than linking directly to the sheet.

And finally, if you like the cheat sheets, and want to say thanks, please consider buying me something from my Amazon Wishlist. Thankyou very much to those who have already hunted it down and sent me something nice - I'm very grateful!

50 comments

Rahul Jain
United States #1: August 1, 2005
Thanks for creating this sheet.
This is great, thanks for making all of your cheat sheets. I make use of your CSS one a lot, so kudos and the sort.
good stuff! thank you.
Great ideas! Any chance you could do a "Cheat Sheet" on how you creat these wonderful beauties so that we might contribute others?
Smithee
United States #5: August 2, 2005
Thanks very much. I was just fiddling with js this weekend and wishing I had a good cheat sheet.
Just found these cheat sheets today and I've already used them twice. Thanks!
Hi Daniel. The cheat sheets are created through a long process of scribbling notes. My desk is covered in printouts and jottings from the various languages I use. These cheat sheets are based on those notes, with various other bits and pieces added. The idea is that they provide quick access to the stuff people often can't remember quickly or are always looking up.

Thanks, all, for your comments!
Hello, thanks for creating that sheet. Within PDF, all Fonts look rather ... rasterized. Do you have the possibility to recreate those PDFs with PDF-Fonts, that scale clear?
Laurent B
France #9: August 2, 2005
On each Cheat Sheet, why not to align the vertical text of the left column to the left, instead of right ?
It will be easier to read and more efficiently. No ?
Hi Dave.

These sheets are great!
Just one thing..

What are you using to create the pdf's? I have noticed that you have rasterised them. Is there any reason for this? Embeded fonts would print so much nicer.

Marc
Hi Marc,

I am working on better versions of the cheat sheets at the moment. Hopefully I'll have them ready in the next few weeks!
Glenn McLelland
United States #12: August 2, 2005
Any plans to offer a Flash MX cheat sheet?
Thanks for creating this sheet, Dave, I will keep an eye on your site ;)

With warm greetings from Saarbuecken, Germany,
Vitaly Friedman
PDF version is with almost 0% quality.
Thanks
Denmark #15: August 23, 2005
I love you
anjan bacchu
United States #16: September 2, 2005
hi there,

there is an implicit object with which every (ordinary) function is associated with. The exact implicit object itself is dependent on the environment(I.E, mozilla, rhino, etc). This is same for Ruby language too.
This is great, thanks a lot!
good job ! thank you
Robert
United States #19: September 7, 2005
wow the PDF can not be searched and text can not be selected !!!

Can you please fix that ?
thanks
Thanks. Keep up good work. :)
Shouldn't the event handlers be all lower-case?

Also, might want to remove the "on" part, since DOM 2 and 3 work with just the event type name without the "on" prefix.
Actually, the correct way to implement JavaScript Code into an XHTML 1.x Strict page is:

<script type="text/javascript">
//<![CDATA[

//your javascript here...

//]]>
</script>

Notice that there is NO language attribute.
Notice the CDATA Wrapper, which is idicating that the code in between is not XML-Formed.

wbr

B!
 United States #23: December 1, 2005
This is wonderful, thank you for the effort!
Thanks for this cheat sheet with explanation of sections. :) I am linking it from my site.
Excellent!
Sergej Brin
Ireland #26: December 18, 2005
Very good site! I like it! I just wanted to pass on a note to let you know what a great job you have done with this site..Thanks!
Great work! Thanks a lot!

This has motivated me to make a Prototype (http://prototype.conio.net/) cheat sheet
Green
Germany #28: March 8, 2006
I am missing "call" and "apply", or am I just too short-sighted?...

Thanks
Very handy!
mjmohan Reddy, India, Hyderabad
India #30: May 6, 2006
ThanQ very much
This is absolutely perfect.
And Love And Other Near Death Experiences is a brilliant book.

Either way, thanks so much for taking the time. These are great.
Michel
Netherlands #32: June 16, 2006
Love IT!
Great idea, almost makes me wish I could program. Only comment - why not make the PDF a true PDF instead of a packaged image. Would make for a nicer printed copy
Gonzalo
Canada #34: June 19, 2006
I'm always looking at sites on my favourites. This a great handy idea. Thank you
Charlie Mansfield
United Kingdom #35: June 20, 2006
The PDF Sheet seems to lack

getElementsByName

document.getElementsByName("preserve")[i].style.color = colour;
Priyadarshi Chaudhuri
India #36: June 26, 2006
It's a great tool.I always keep referring to it while coding. It has made life easier
Baskar
United States #37: June 26, 2006
It's a great peace of work.
Jani Sjölund
Finland #38: July 3, 2006
Hi and Thank you for the cheat sheet. It's very handy. I do have an request though, is it possible to get also operators included? I mostly forget them, and its very frustating ;-)
Marijn
Netherlands #39: August 7, 2006
Hi, great sheet! I'm almost using it daily now. As a webdeveloper this is really handy as a quickreference, it's even faster than googling :).

But by using it I found a 'bug, in the 'range' section you list 'parentElement', but parentElement is only supported by IE, FireFox does not. So it's better to use parentNode, which is supported by both browsers.
Great sheet. How can I download all the sheets ? The pdf only contains the first page.
Ah , there is only one. Thanks
Great stuff !. I'm going to link to this from my class site for all of my students. This will be a huge help to them. Many thanks for your hard work!
Alexv
Argentina #43: September 4, 2008
May I use it in face book as a symbol for javascript group in Spanish ?
Is it just me, or can only the first page of each cheat sheet be downloaded? I cannot see any pages after the first page.
@Don: Just you, I'm afraid - the cheat sheets are all one page intentionally - they're supposed to be single page references.

@Alexv: Certainly. It's released under a CC license.

@Everyone Else: Thanks :)
Ah, yep. Sorry, my boneheaded mistake. LOL!

Remember, we can't even vote right down here. *chuckle!*
By the way, really nice cheat sheets!
Hi,
I want to make you my compliments for your blog.
it is very interesting and I think that I will become one reader of your blog.
Selo
Hungary #49: October 14, 2008
Thousand thanx' what u've ever made friend. :)
Great job!
Very useful cheat sheets for programmer.
Great job you did....

Post Your Comment

· Comments with keywords instead of a name have their URLs removed.
· Your email address will not be displayed or shared.

Live Comment Preview

 United States #51: 1 minute ago