📜  let 和 var 的区别 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:19.735000             🧑  作者: Mango

代码示例3
/* DIFFERENCE BETWEEN LET AND VAR */

//LET EXAMPLE
{
  let a = 123;
};

console.log(a); // undefined

//VAR EXAMPLE
{
  var a = 123;
};

console.log(a); // 123