📜  使用什么 let vs var js - Javascript 代码示例

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

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

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

console.log(a); // undefined

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

console.log(a); // 123