Browser issue? Understanding var v let Keywords

If you want to get the same result, you must call the function: checkScope(). If just copy and paste, only you’re defining the function.

For example,

let x = 'hello world' // you get undefined
console.log(x) // you get 'hello world'