図1
for (var i = Things.length - 1; i >= 0; i--) {
setTimeout(function(){
// do something with Things[i]
}, 200 * i);
};
図 2
$(".things").each(function(i,o){
setTimeout(function(){
//do something with o
}, 200 * i);
});
図 2 は機能するのに、図 1 は機能しないのはなぜですか? 最初の方法を試すたびに、i
常に equals になり-1
ます。何を与える?