Learn JavaScript VARIABLE SCOPE in 5 minutes!

8 Views
Published
// variable scope = where a variable is recognized
// and accessible (local vs global)

let x = 3; // global scope

function1();

function function1(){
let x = 1; // local scope
console.log(x);
}

function function2(){
let x = 2; // local scope
console.log(x);
}
Category
Bro Code
Tags
javascript, javascript tutorial, javascript full course
Be the first to comment