I found out yesterday that the iphone does not allow the use of let. This leaves me woundering how to deal with asyncronous calls like ajax and time outs. Bellow is an example code showing the difference. How can I make the var half function the same as the let half without using keywords that some devices won't like?
$("body").append("VAR:<br>");
for (var i=0;i<10;i++) {
setTimeout(function(){
$("body").append(i +"<br>");
},Math.random()*1000);
}
//make lets come after var
setTimeout(function(){
$("body").append("LET:<br>");
for (let i=0;i<10;i++) {
setTimeout(function(){
$("body").append(i +"<br>");
},Math.random()*1000);
}
},2000);