Q: 16
Refer the code below.
x=3.14;
function myfunction() {
"use strict";
y=x;
}
z=x;
myFunction();
Your Answer
Discussion
REFERENCEERROR
Really clear code snippet for testing case sensitivity in JS.
Anyone else seen similar case-sensitive function name questions on their exam? Looks like ReferenceError would be triggered here due to the naming mismatch.
REFERENCEERROR
Pretty common mistake in JS exams. Since the function name is called with a capital F but defined lowercase, you get a ReferenceError. Official docs and sample practice tests show similar examples.
Oops, I thought it would be a TypeError because of the strict mode assignment. But actually the function call's case is wrong, so ReferenceError comes first. Did anyone else miss that detail at first?
Be respectful. No spam.