The code will output: 2 1. This demonstrates block scoping with the let keyword. The first let x = 1 creates a variable x in the outer scope. Inside the if block, let x = 2 creates a new variable x in the inner scope, which shadows (hides) the outer x. The console.log(x) inside the if block refers to the inner x, which is 2. After the if block ends, the inner x goes out of scope, and the console.log(x) refers to the outer x, which is still 1. This is why using let (or const) for variable declarations is often safer than var, which doesn't have block scope.