closure and settimeout question in for loop [duplicate]

Can someone tell the outputs of the following code.
I just want to print 1 2 3 4 5 on the console after 1s

1)

for (var i = 0; i < 5; ++i){
    setTimeout(() =>{
        console.log(i);
    }, 1000);
}

for (let i = 0; i < 5; ++i){
    setTimeout(() =>{
        console.log(i);
    }, 1000);
}

for (let i = 0; i < 5; ++i){
    setTimeout((i) =>{
        console.log(i);
    }, 1000);
}

All of them are giving different answer and i dont know why. Please help!!