Do variable declaration with let and const in JavaScript work differently in block scope and global scope?

前端 未结 0 1101
孤城傲影
孤城傲影 2021-02-05 20:59

Here are two examples:

console.log(x);
let x = 4;

throws Reference Error x is not defined;

{
console.log(y);
let y = 3;
}         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题