How can I get this
var i = 0;
var codes = [1, 2, 3];
for (var i = 0; i < codes.length; ++i)
{
    setTimeout(function(){alert(codes[i]);},100);
}
To alert 1, 2 and 3 without using let keyword?
or bind an event on an element (example):
var i = 0;
var codes = [1, 2, 3];
for (var i = 0; i < codes.length; ++i)
{
    $("div").eq(i).click(function(){
        alert( codes[i] );
    });
}
 
     
     
     
     
     
     
    