I'm running into some strange behavior where a variable declared with `let` inside a loop retains the value from a previous iteration if it hasn't been initialized in the current iteration.
For instance, the following code:
for (var i of [0, 1]) {
  let x;
  if (i % 2 === 0) {
    x = i;
  }
  console.log(`x: ${x}`);
}
Outputs:
And more strangely, the following code:
for (var i of [0, 1]) {
  let x;
  if (i % 2 === 0) {
    x = i;
  }
  console.log(`x: ${x}`);
  var f = function() {
    var y = x;
  };
}
Outputs:
I'm wondering if the ES6 spec specifies whether a variable declared using `let` inside a loop should be scoped to the current iteration of the loop or if it should be scoped to the loop block with the variable shared between all iterations.