how to interpret the running results of the following two-end code
1
The callback inan is called bjournal b to print x. Why can"t b get x in a;
let a=fn=>{const x=1;fn();};
let b=()=>{console.log(x)};
a(b); //Uncaught ReferenceError: x is not defined
2
let a=fn=>{ x=1;fn();};
let b=()=>{console.log(x)};
x; // Uncaught ReferenceError: x is not defined
a(b); // 1