暂时性死区

function go(n) {
  // n here is defined!
  console.log(n); // Object {a: [1,2,3]}

  for (let n of n.a) { // ReferenceError 这就算是暂时性死区 因为在这个作用域内改变了被声明以后 是不可以提前调用的。
    console.log(n);
  }
}

go({a: [1, 2, 3]});
原文地址:https://www.cnblogs.com/l8l8/p/9717472.html