What does this function print? JavaScript Quiz | Interview Question

@Yomesh Gupta

What would be the output of the following code snippet if we execute it as it is.

let number;
for (var i = 0; i < 5; i++) {
  number = i;
  setTimeout(function() {
    console.log(number);
  }, 1000);
}
Option 1
0
1
2
3
4
Option 2
1
2
3
4
5
Option 3
Error
Option 4
5
5
5
5
5
Option 5
undefined
undefined
undefined
undefined
undefined
Option 6
4
4
4
4
4