Refer to the code below:
new Promise((resolve, reject) => { const fraction = Math.random();
if( fraction >0.5) reject("fraction > 0.5, " + fraction); resolve(fraction);
})
.then(() =>console.log("resolved"))
.catch((error) => console.error(error))
.finally(() => console.log(" when am I called?"));
When does Promise.finally on line 08 get called?
Correct Answer:
D
Given the following code: document.body.addEventListener(‘ click ’, (event) => { if (/* CODE REPLACEMENT HERE */) {
console.log(‘button clicked!’);
)
});
Which replacement for the conditional statement on line 02 allows a developer to correctly determine that a button on page is clicked?
Correct Answer:
C