Mark Dalgleish

Mark Dalgleish

UI Engineer - Melbourne, Australia

Getting Closure in JavaScript

On May 23-24 2012, the first Web Directions Code event was held in Melbourne. With twenty talks from local and international presenters, including Faruk Ates and Ryan Seddon (Modernizr), Divya Manian (HTML5 Boilerplate, HTML5 Readiness), Dmitry Baranovskiy (Raphael), Dave Johnson (Phonegap) and, of course, the inimitable John Allsopp, one of the masterminds behind Web Directions.

I was extremely excited to have been invited to be part of such a great new conference targeted at the more code-oriented aspects of our industry. Presenting on the second day of the event (a whole day dedicated to JavaScript), I gave a 15 minute talk titled “Getting Closure”.

As the official description reads, it was an in-depth look at how JavaScript’s first-class functions and lexical scope allow us to write powerful and expressive code. Through the single topic of immediately invoked function expressions, we touched upon function scope, closures, JavaScript “classes”, CoffeeScript and ECMAScript 5.

Most importantly, my presentation aimed to clear up any confusion around closures, one of JavaScript’s most powerful features. Interestingly enough, even those who I consider seasoned veterans found that my presentation helped solidify their mental model and ensure that their terminology is correct, something that can be quite tricky with such an abstract concept.

Web Directions Code 2012 was a fantastic event and I’m greatly looking forward to more in the future. Many thanks, as always, to Maxine Sherrin and John Allsopp for providing such an awesome conference and for their tireless efforts in bolstering the Australian web developer community.

Further reading: