Why is it logging "Reference Error" in the first case, why didn't it pick it from the global scope like in the second case?
let a = 10;
function test1() {
console.log(a);
let a = 100;
}
test1(); // Reference Error
let a = 10;
function test2() {
console.log(a);
}
test2(); //10