Jesse Skinner

Cleaner Callbacks with Closures

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.

Published on June 13rd, 2006. © Jesse Skinner

About the author

Jesse Skinner

I'm Jesse Skinner, a freelance software engineer. Since 2001 I've been building web apps that last, and rescuing those that didn't. I'm available to take on one or two new clients. Here's how I work.

Contact Jesse

Need help with a project? Any questions? I'd love to hear from you.

Email me at [email protected]