Refer to the code below:
let strNumber = ' 12345 ' ;
Which code snippet shows a correct way to convert this string to an integer?
Refer to the code:
01 let car1 = new Promise((_, reject) = >
02 setTimeout(reject, 2000, " Car 1 crashed in " ));
03 let car2 = new Promise(resolve = >
04 setTimeout(resolve, 1500, " Car 2 completed " ));
05 let car3 = new Promise(resolve = >
06 setTimeout(resolve, 3000, " Car 3 completed " ));
07
08 Promise.race([car1, car2, car3])
09 .then(value = > {
10 let result = ' $(value) the race. ' ;
11 })
12 .catch(err = > {
13 console.log( " Race is cancelled. " , err);
14 });
What is the value of result when Promise.race executes?
01 function Monster() { this.name = ' hello ' ; };
02 const m = Monster();
What happens due to the missing new keyword?
Refer to the code:
const pi = 3.1415926;
What is the data type of pi?
Given the HTML below:
< div >
< div id= " row-uc " > Universal Containers < /div >
< div id= " row-as " > Applied Shipping < /div >
< div id= " row-bt " > Burlington Textiles < /div >
< /div >
Which statement adds the priority-account CSS class to the Applied Shipping row?
A test searches for:
< button class= " blue " > Checkout < /button >
But the actual HTML is:
< button > Checkout < /button >
The test fails because it expects a class that no longer exists.
What type of test outcome is this?
Corrected code:
let obj = {
foo: 1,
bar: 2
};
let output = [];
for (let something in obj) {
output.push(something);
}
console.log(output);
What is the output of line 11?
Refer to the following code:
< html lang= " en " >
< body >
< button class= " secondary " > Save draft < /button >
< button class= " primary " > Save and close < /button >
< /body >
< script >
function displaySaveMessage(event) {
console.log( ' Save message. ' );
}
function displaySuccessMessage(event) {
console.log( ' Success message. ' );
}
window.onload = function() {
document.querySelector( ' .secondary ' )
.addEventListener( ' click ' , displaySaveMessage, true);
document.querySelector( ' .primary ' )
.addEventListener( ' click ' , displaySuccessMessage, true);
}
< /script >
< /html >
A developer wrote the following code:
01 let x = object.value;
02
03 try {
04 handleObjectValue(x);
05 } catch(error) {
06 handleError(error);
07 }
The developer has a getNextValue function to execute after handleObjectValue(), but does not want to execute getNextValue() if an error occurs. How can the developer change the code to ensure this behavior?
After user acceptance testing, the developer is asked to change the webpage background based on the user’s location. It works on the developer’s computer but not on the tester’s machine.
Which two actions will help determine accurate results?