Reminds me a lot of Bret Victor’s “inventing on principle” talk and his “learnable programming” essay. Great way to connect the creator with the consequence of their action. I’m a visual learner myself (I know the science of learning styles is bunk) and have found most to benefit from a similar way to “seeing code”.
Thanks. I will be watching all his stuff. I hadn't watched Inventing on principle when I commented before...I came back to say - I think it's the best tech-related talk I've ever seen. Well, so much wider than just computers or programming--although mainly about that on one level--but it's about one's life, purpose, meaning in life etc. The first computery talk I've seen that seemed wise, strikingly so, not just smart, clever, cool, brilliant, innovative etc. Thank you HN!
for (var i = 0; i < 3; i++) {
var text = 'number ' + i;
setTimeout(function() {
console.log(text);
}, i * 1000);
}
But flipping var to let will fix it. The bug is that var is not block-scoped so everything refers to the same `text` variable which gets mutated by the next iteration.
I was hoping their demo would be good for explaining this bug but it seems to be broken.
It was a great complementary tool explaining some simple algo to students.