You have a webpage that includes the following markup and code:
You need to troubleshoot the code by clicking the Submit button.
Which value will be displayed?
A.
10
B.
20
C.
Undefined
D.
Runtime error
You have a webpage that includes the following markup and code:
You need to troubleshoot the code by clicking the Submit button.
Which value will be displayed?
A.
10
B.
20
C.
Undefined
D.
Runtime error
I have an offtop question: how do you call the “fun” function?
you cant, it is a private variable of start function
You should be able to call if from within start()… right?
Undefined is true!
function start() {
var counter = 10
var fun = function () {
counter = 20;
}
return counter;
}
console.log(start());
I tested it, it displays “10”. var fun is never called so the counter is not ever updated to 20, and its definitely not undefined or a runtime error.