// program showing local scope of a variable
let a = "hello";
function greet() {
let b = "World"
console.log(a + b);
}
greet();
console.log(a + b); // error
// program to print a text
let a = "hello";
function greet () {
console.log(a);
}
greet(); // hello
/*
In JavaScript, a variable has two types of scope:
1. Global Scope
2. Local Scope
*/