I'm a novice and pretty confused with the following code.
for (var i=1; i<=5; i++) {
console.log('ooo');
setTimeout( function timer(){
console.log( i );
}, i*1000 );
}
The output of this code was something like this:
ooo
ooo
ooo
ooo
ooo
6
6
6
6
6
Thanks in advance in explaining me this code.