ecmascript-2015
Registering event handlers in JavaScript when iterating through document elements
This question is not a duplicate, as it affects not only closures, but also other common errors in JS, as well as their elimi ... </body>
</html>
Answer: The easiest and fastest way to declare all variables is with let instead of var.