ES6 - Compare Scopes of the var and let Keywords

I can’t understand where is the problem.I have write this code and i get back the error
< The variable i declared in the if statement should equal the string block scope.

function checkScope() {
let i = “function scope”;

if (true) {
let i= “block scope”;
console.log("Block scope i is: ", i);
}
console.log("Function scope i is: ", i);
return i;
}

Do you have a link to the challenge?

1 Like

You’ve basically done it correctly, but this:

let i= “block scope”;

In “normal” JS formatting, you would also have an space before the =. You do not have that here. The test must be looking for that specific string in the code because when I add that space, the code passes. Yes, the code should take that into account, but also, it’s a reminder to develop a good sense of standard formatting - your future teammates will thank you. :wink: