Question 46
Corrected code:
let a = "*";
let b = "**";
// x = 3;
console.log(a);
What is displayed when the code executes?
let a = "*";
let b = "**";
// x = 3;
console.log(a);
What is displayed when the code executes?
Question 47
A developer wants to catch any error that countSheep() may throw and pass it to handleError().
Which implementation is correct?
Which implementation is correct?
Question 48
Refer to the code below:
01 let total = 10;
02 const interval = setInterval(() => {
03 total++;
04 clearInterval(interval);
05 total++;
06 }, 0);
07 total++;
08 console.log(total);
Considering that JavaScript is single-threaded, what is the output of line 08 after the code executes?
01 let total = 10;
02 const interval = setInterval(() => {
03 total++;
04 clearInterval(interval);
05 total++;
06 }, 0);
07 total++;
08 console.log(total);
Considering that JavaScript is single-threaded, what is the output of line 08 after the code executes?
Question 49
Refer to the code below:
flag();
function flag() {
console.log('flag');
}
const anotherFlag = () => {
console.log('another flag');
}
anotherFlag();
What is result of the code block?
flag();
function flag() {
console.log('flag');
}
const anotherFlag = () => {
console.log('another flag');
}
anotherFlag();
What is result of the code block?
Question 50
Given the JavaScript below:
01 function filterDOM(searchString){
02 const parsedSearchString = searchString && searchString.toLowerCase();
03 document.querySelectorAll('.account').forEach(account => {
04 const accountName = account.innerHTML.toLowerCase();
05 account.style.display = accountName.includes(parsedSearchString) ? /* Insert code here */;
06 });
07 }
Which code should replace the placeholder comment on line 05 to hide accounts that do not match the search string?
01 function filterDOM(searchString){
02 const parsedSearchString = searchString && searchString.toLowerCase();
03 document.querySelectorAll('.account').forEach(account => {
04 const accountName = account.innerHTML.toLowerCase();
05 account.style.display = accountName.includes(parsedSearchString) ? /* Insert code here */;
06 });
07 }
Which code should replace the placeholder comment on line 05 to hide accounts that do not match the search string?
