Bummer! This is just a preview. You need to be signed in with an account to view the entire instruction.
Well done!
You have completed (UPI) Chapter 11: Managing Errors, Debugging, and Handling Events in JavaScript!
Instruction
Wrong scope
A variable needs to be available in the current context of execution. Variables defined inside a function cannot be accessed from anywhere outside the function, because the variable is defined only in the scope of the function.
function numbers() {
const num1 = 2;
const num2 = 3;
return num1 + num2;
}
console.log(num1); // ReferenceError: num1 is not defined.
However, a function can acces...