Question: Question 6 (1 point) var x=0; try { x = y + 1; } catch(err) { document.getElementById(WEBT2300).innerHTML = err.name; } What is the output of
Question 6 (1 point)
var x=0;
try {
x = y + 1;
}
catch(err) {
document.getElementById("WEBT2300").innerHTML = err.name;
}
What is the output of the above code?
A. NaN
B. nothing
C. ReferenceError
D. 0
Question 7 (1 point)
try {
eval("alert('JavaScript)");
}
catch(err) {
document.getElementById("WEBT2300").innerHTML = err.name;
}
What is the output of the above script.
A. nothing
B. SyntaxError
C. JavaScript
D. ReferenceError
E. 0
Question 8 (1 point)
what is the return value of
"SELECT".substring(0, 5)?
A. "SELECT"
B. "SELE"
C. "ELECT"
D. "SELEC"
Question 9 (1 point)
var num = 100;
try {
num.toUpperCase();
}
catch(err) {
document.getElementById("WEBT2300").innerHTML = err.name;
}
what is the output of the above script?
A. ReferenceError
B. TypeError
C. Illegal expression
D. SyntaxError
E. 100
Question 10 (1 point)
try {
decodeURI("%&%");
}
catch(err) {
document.getElementById("WEBT2300").innerHTML = err.name;
}
A. TypeError
B. URIError
C. ReferenceError
D. SyntaxError
Question 11 (1 point)
"unhappy".substring(2)
returns
'happy'
True or False
Question 12 (1 point)
We want to examine the input we read. If the value is wrong, an exception (err) is thrown. The exception (err) is caught by the catch statement and a custom error message is displayed according to:
a- If the value entered is a number throw 'not a character" b- if the value read smaller than e return 'smaller than e'. c- if the value read greater than m return 'greater than m'.
Replace a-,b-,c- with the below statements.
Please input a letter between 'e' and 'm':
A.
if(!isNaN(x)) throw "not a character";
if(x < 'd') throw "too low";
if(x > 'm') throw "too high";
B.
if(!Number(x)) throw "not a character";
if(x > 'd') throw "too low";
if(x < 'm') throw "too high";
C.
| if(Number(x)) throw "not a character"; if(x < 'd') throw "too low"; if(x > 'm') throw "too high"; |
D.
if(isNaN(x)) throw "not a character";
if(x > 'd') throw "too low";
if(x < 'm') throw "too high";
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
