Question: Can you answer the following multiple choice: 1) What does a Promise represent? That you may get a value or error at some point in

Can you answer the following multiple choice:

1) What does a Promise represent?

That you may get a value or error at some point in the future

That you will not get a null back

That you will immediately get an object

A guarantee that your program will never have any errors

2) Which of the following is a "chainable" method on a Promise?

when

response

catch

try

function logLater(message, delay) { return new Promise((resolve, reject) => { setTimeout(() => { // line 4 - what would `message` be? resolve(); }, delay); }); } logLater('Hello', 1000) .then(() => logLater('Good bye', 5000));

3) Given the above code, when will line 4 be evaluated, and what would the message variable be at that point in the code?

Line 4 will be evaluated almost immediately, and message will be "Hello". After a one second delay, line 4 will be evaluated again, and message will be "Good bye"

Line 4 will be evaluated after a one second delay, and message will be "Hello". After another five second delay, line 4 will be evaluated again, and message will be "Good bye".

Line 4 will be evalated almost immediately, and message will be "Hello". After a six second delay, line 4 will be evaluated again, and message will be "Good bye"

Line 4 will be evalated almost immediately, and message will be "Hello". Almost immediately after that, Line 4 will be evaluated again, and message will be "Good bye"

4) What is the state that a Promise cannot be in?

Rejected

Fulfilled

Inconsistent

Pending

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!