If WHAT is true?

no comparator. no equivalence statement.
if what is true?

 let i='function scope';
  if (true) {
    let i = 'block scope';
   function checkScope() {
.........
//var i = 'function scope';
let i='function scope';
if (true) {
  // i='block scope';
  let i = 'block scope';
  console.log('Block scope i is: ', i);
}
console.log('Function scope i is: ', i);
return i;
}
checkScope();
  **Your browser information:**

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

Challenge: Compare Scopes of the var and let Keywords

Link to the challenge:

true is true, so the code inside the if statement always execute.
This is the simplest way to put something inside a block to show the difference between let and var

1 Like

oh, yeh
true is true
lol

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