JavaScript:
01 function Tiger() {
02 this.type = ' Cat ' ;
03 this.size = ' large ' ;
04 }
05
06 let tony = new Tiger();
07 tony.roar = () = > {
08 console.log( ' They\ ' re great! ' );
09 };
10
11 function Lion() {
12 this.type = ' Cat ' ;
13 this.size = ' large ' ;
14 }
15
16 let leo = new Lion();
17 // Insert code here
18 leo.roar();
Which two statements could be inserted at line 17 to enable line 18?
Given the code:
const copy = JSON.stringify([new String( ' false ' ), new Boolean(false), undefined]);
What is the value of copy?
for (let number = 2; number < = 5; number += 1) {
// faster code statement here
}
Which statement meets the requirements to log an error when the Boolean statement evaluates to false?
Refer to the code below (corrected to use a template literal on line 08):
01 let car1 = new Promise((_, reject) = >
02 setTimeout(reject, 2000, " Car 1 crashed in " )
03 );
04 let car2 = new Promise(resolve = >
05 setTimeout(resolve, 1500, " Car 2 completed " )
06 );
07 let car3 = new Promise(resolve = >
08 setTimeout(resolve, 3000, " Car 3 completed " )
09 );
10
11 Promise.race([car1, car2, car3])
12 .then(value = > {
13 let result = `${value} the race.`;
14 })
15 .catch(err = > {
16 console.log( " Race is cancelled. " , err);
17 });
What is the value of result when Promise.race executes?
A page loads 50+ < div class= " ad-library-item " > elements, all ads.
Developer wants to quickly and temporarily remove them.
Options:
Given a value, which three options can a developer use to detect if the value is NaN?
A developer is trying to convince management that their team will benefit from using Node.js for a backend server that they are going to create. The server will be a web server that handles API requests from a website that the team has already built using HTML, CSS, and JavaScript.
Which three benefits of Node.js can the developer use to persuade their manager?
Refer to the code below:
01 let timedFunction = () = > {
02 console.log( ' Timer called. ' );
03 };
04
05 let timerId = setInterval(timedFunction, 1000);
Which statement allows a developer to cancel the scheduled timed function?
Refer to the code below:
01 function changeValue(param) {
02 param = 5;
03 }
04 let a = 10;
05 let b = a;
06
07 changeValue(b);
08 const result = a + ' - ' + b;
What is the value of result when the code executes?
A developer wants to catch any error that countSheep() may throw and pass it to handleError().
Which implementation is correct?