Tell us what’s happening:
The answer is correct but the example code doesn’t produce any output at the first place. A user can only see output after calling the function.
let x = 10;
function myFunction() {
let x = 20;
console.log(x);
}
This piece of code doesn’t produce any output. But
let x = 10;
function myFunction() {
let x = 20;
console.log(x);
}
myFunction();
This one does.
Your code so far
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36
Challenge Information:
Learn Function Basics - Learn Function Basics Lesson C