Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

WHY IS JS CONSOLE AIN'T EXECUTING THE CODE?(level 8 lesson8)

let a = "Hello";

function greeting() {
/ Add the local variable here/
let b = "Studytonight";

console.log(`${a} ${b}`);
}
greeting();
console.log(a + b);

I am stuck at this for almost an hour.
console panel shows that "try again"
Please fix this error asap.
by

3 Answers

iamabhishek
Please check once, the compiler service is working fine and JS compiler is returning responses.
Shivanitgxoe
no it's not working. Console panel is showing try again even though my code is correct.
Shivanitgxoe
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.

Login / Signup to Answer the Question.