From: Paul Stickney Date: 2008-01-12T15:57:47+09:00 Subject: Re: problem with closure/block > I think it's an advantage in javascript, that you have to mark new > variables with "var", so the scope of a variable is always obvious. JS doesn't have it right... if anything, I've seen it cause MUCH MORE confusion wrt closures. 'var' is context-specific (only applies INSIDE functions, but syntactically valid outside) and it is just a hint, not a declaration. These are the same: function a(z) { var x = z; return function () {return x} } function b(z) { x = z; return function () {return x}; var x } and: var x = 10; // outside a function is both misleading and useless.