... until the collector arrives ...

This "blog" is really just a scratchpad of mine. There is not much of general interest here. Most of the content is scribbled down "live" as I discover things I want to remember. I rarely go back to correct mistakes in older entries. You have been warned :)


Javascript 1.7

Javascript 1.7 introduces a number of new features, including let.  I couldn't figure out what the difference was between for(var i ...) and for(let i ...) - until I tried it.  It hadn't occurred to me before, but Javascript does not (that is, did not) have block scope.  It only has global and function scopes.  So the first example introduces a new variable i within the enclosing function (or, failing that, global) scope.  The let version introduces i within block scope.

Here is a little sandbox for playing with Javascript 1.7 (I'd only expect it to work in Mozilla, of course).

Blog Archive