JavaScript – scopes – Doh!

I’ve been working with JavaScript a lot in the last 3 weeks. I have to admit to loving it. It’s not my first foray with the language and I’m not a novice. However I’m no expert either.

I keep falling into these traps of scope issues that I just can’t pull my head out of. As soon as I recognize the problem I turn into Homer Simpson: “doh!”.

And it’s always with anonymous functions. I keep forgetting that they don’t see the variables outside of themselves or inside their parent function.

“Doh!”

Category: Code Comment »


Leave a Reply



Back to top