Closures Shmosures

Ever heard those javascript snobs talk about closures? "Closures" they'll say "are one of the most powerful concepts in javascript, but they can cause a lot of problems (like memory leaks) if you don't know what you're doing."

I say PHOOEY! Throw caution to the wind and use closures. Personally, I think the warning against closures is just so the javascript elite can continue to feel "elite." No one can dispute the benefits of closures; they're just way too convenient not to use. And anyone who throws the "memory leak" excuse at you is probably referring to IE6's well know memory leak problems (and we can only hope that IE7 will resolve those issues).

So obviously I'm going to talk about closures, but for the sake of simplicity, I want to only focus on one specific technique that involves closures: passing object parameters to a setTimeout(..) function. Read on to learn more.

Continue reading Closures Shmosures

just beginning

Welcome to ecmascript.stchur.com. This is a blog where I'll be discussing ECMAScript (or Javascript if you prefer; just please don't call it "JScript") — simple Javascript (you gotta start somewhere), advanced Javascript (to whatever extent I'm able), stupid Javascript (lots of this out there), cool Javascript (Shaun Inman, Dean Edwards, James Edwards, and Danny Goodman come to mind), and anything else I feel like discussing (I'll do my best to stay on topic though).