Why does this JavaScript loop log 3, 3, 3? (and what it reveals about how JS really works)

A no-fluff guide to var, let, and const, the basics you think you know, and the weird parts that will bite you in an interview.