Coding with Jesse

Cleaner Callbacks with Closures

June 13rd, 2006

Dan Webb at The Web's Bollocks has posted a great article, Cleaner Callbacks With Partial Application. It describes ways to use JavaScript closures to keep your code cleaner and more reusable, especially when creating XMLHTTPRequest callbacks. If you understand the basics of closures but want to see some practical applications, go check it out.

If you're new to closures or have been struggling to understand how they work, I recommend reading Mark Wubben's introduction, Getting Funky With Scopes and Closures. For a more detailed and thorough analysis, be sure to read Richard Cornford's JavaScript Closures.

About the author

Jesse Skinner Hi, I'm Jesse Skinner. I work with development teams to speed up and stabilize web applications, reduce server costs, fix difficult bugs, modernize legacy applications, and improve developer productivity. I'd love to hear from you and see how I can make your life easier.