Lesson 24 of 50

JavaScript Scope

Scope defines the accessibility of variables. There are three main types: global, function, and block scope.

let globalVar = "Global";

function testScope(){
  let localVar = "Local";
  console.log(globalVar); // accessible
}
← Previous Next →