What will the following JavaScript code output?


for (var i = 0; i < 3; i++) {

  setTimeout(function() { alert(i); }, 1000 + i);

}