const { log } = console;// ----------------------------------------------// โญ๏ธ scopes around a classic for-loopโ// ----------------------------------------------// ๐ธ (1) outer scope// ๐ธ (2) "init-block" scope//// โ โ// โ a special "init-block" scope lies between โ// โ "outer scope" and "inner block scope" โ// โ โ โ// โ// โญโ (2) init-blk scope โโโฎ// โ โfor ( let i =0; i <3; i++ ) { // โญ๏ธ `i` is invisible outside `for`// ๐ธ (3) inner "block scope"// --------------------------------------------------------let i =100; // โญ๏ธ index `i` can be declared againโ// ----------------------------------------// Should (2) and (3) be the same scope, // this would have been a SyntaxError.// ( `let` doesn't allow redeclarationsโ)// --------------------------------------------------------log(i); // 100, 100, 100}// โ "var" has no "init-block" scope//// โญโโ init-block scope โโโโฎfor (var j =10; j <13; j++) { // โญ๏ธ `j` is visible outside `for`โlog(j); // 10, 11, 12}// log[// โญ๏ธ "let" is invisible outside for loop// i, // โ ReferenceError: i is not defined// โญ๏ธ "var" is visibleโ j,// 13].forEach(x =>console.log(x));