scrimba
Learn Modern JavaScript
Compare Scopes of the var and let Keywords
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Compare Scopes of the var and let Keywords
AboutCommentsNotes
Compare Scopes of the var and let Keywords
Expand for more info
index.js
run
preview
console
function checkScope() {
"use strict";
var i = "function scope";
if (true) {
i = "block scope";
console.log("Block scope i is: ", i);
}
console.log("Function scope i is: ", i);
return i;
}

checkScope();
Console
"Block scope i is: "
,
"block scope"
,
"Function scope i is: "
,
"block scope"
,
index.html
-2:27