Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions

Question

Understand what a service-oriented culture is.

Answered: 1 week ago

Question

Explain the key areas in which service employees need training.

Answered: 1 week ago