You can use an immediately-invoked function expression (IIFE) to create a closure around setTimeout
:
for (var i = 1; i <= 3; i++) {_x000D_
(function(index) {_x000D_
setTimeout(function() { alert(index); }, i * 1000);_x000D_
})(i);_x000D_
}
_x000D_