Tell us what’s happening:
Hello, I got through the answer with help online. What I am confused on if (true) logic.
Why do we have to place if (true) within the function?
Thank you!
Your code so far
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;
}
Challenge: ES6 - Compare Scopes of the var and let Keywords
Link to the challenge: