Lesson 8 level 8( scope of variables)
1. Create a global variable named a using let keyword and give value "Hello" to it.
2. Then, create a local variable named b using let keyword within the function body of greeting() function and give value "Studytonight" to it.
3. Click on the Run and you should get an exception in the output.
/ Add global variable a here*/
let a = "Hello";
function greeting() {
/* Add the local variable here/
let b = "Studytonight";
console.log(`${a} ${b}`);
}
greeting();
console.log(a + b);
The compiler is showing try again. Please someone help me to find the error.