Ask HN: Am I one of the few JavaScript programmers who didn't realize this
I'm currently reading "Data structures and Algorithms with Javascript" and I had a WTF! moment when I got to page 9 and read "...Javascript does not have a block scope..."
Meaning this piece of code works! Blimey!
for(var i=0; i<=10; i++){
// do nothing
}
// access 'i' out of for loop
console.log("i = " + i); // i = 11