Learn E36: Compare Scopes of the var and let Keywords

Tell us what’s happening:
Describe your issue in detail here.
I originally attempted the problem on my own. However, I kept on running into the same issue. The code is continually failing the last check. "checkScope() should return the string function scope". I thought it was maybe something I did, so I used the hint and copied/paste their code. The same problem is happening. Is this a bug?

  **Your code so far**

/*
function checkScope() {
"use strict";
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;
}
*/
function checkScope() {
"use strict";
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;
}
checkScope()
console.log(i)
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36

Challenge: Compare Scopes of the var and let Keywords

Link to the challenge:

console.log(i) ///this is causing the test to fail

i does not exist outside the function so a reference error is being thrown when you try to log it, and this error is preventing the test from passing.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.