What’s The Difference in Let and Var In Context of Closure [duplicate]

is in this code the loop in each iteration will create a new Lexical Env ?
because here i see that the outer Lexical of the inner function gets changed every time
unlike if i use var
i mean that var actually skipped the block don’t care about at all

var result = [];;
 
for (let i = 0; i < 5; i++) {
  result[i] = function () {
    console.log(i);
  };
}
result[0](); // 0
result[1](); // 1
result[2](); // 2
result[3](); // 3
result[4](); // 4