Scope
let sum = 71; //GLOBAL SCOPE
function calSum(a, b) {
let sum = a + b; //FUNCTIONAL SCOPE
}
console.log(sum);
//WORKS
function outer() {
let x = 5;
let y = 6;
function inner() {
let z = 33;
console.log(x);
console.log(y);
}
console.log(z);
inner();
}
outer();
// PRACTICE
let greet = "Helloo";
function changeGreet() {
let greet = "namasthe..";
console.log(greet);
function inner() {
console.log(greet);
}
}
console.log(greet);
changeGreet();

Comments
Post a Comment