Are you ready?

1 questions to solve.

Instructions
  1. This quiz goes to full-screen once you press the Start button, or any Next button after exiting the quiz window.
  2. At the end of the quiz, you are able to review all the questions that you answered wrong and see their explanations.
How do we create a new promise?
A promise is created by calling the Promise() constructor. See more at Promises Basics.
In promise terminology, what do we call the function that's passed to Promise(), as an argument?
The function is referred to as the executor. See more at Promises Basics.
The executor function f is executed asynchronously upon calling new Promise(f). True or false?
Clearly false! The executor function is executed synchronously when a new promise object is instantiated. See more at Promises Basics.
Suppose that you've been told that p is a promise. What will typeof p return?
As discussed at the start of the Promises Basics chapter, a promise is an object in JavaScript. Likewise it returns "object" when inspected using typeof.
According to the ES6 specification, a promise can be in one of the three states.... What are they?
The three states are pending, fulfilled and rejected. This goes with choice (B). For more details about how these states work, please refer to Promises Basics.
What will the following code log, after 3 seconds?
var p = new Promise(function(resolve, reject) {
    setTimeout(function() {
        resolve("Good");
    }, 3000);
});

p.then(function(data) {
    console.log("OK " + data);
});
After 3 seconds, resolve("Good") is called from within the timeout, which fires the function queued up by then() in line 7, with an argument "Good". The function logs "OK" + data, where data is equal to "Good", hence we get "OK Good" logged.
Which parameter of the executor serves to fulfill its respective promise?
The first parameter of the executor, known as resolve, fulfills its respective promise. This goes with choice (A).
In the code shown below, what is p's internal slot [[PromiseValue]] equal to, once p gets fulfilled; by calling resolve() in line 3?
var p = new Promise(function(resolve, reject) {
    setTimeout(function() {
        resolve();
    }, 3000);
});
Whichever argument is passed to resolve(), is the value with which the corresponding promise is fulfilled i.e the value that goes into [[PromiseValue]]. In this case we call resolve(), with no arguments, or better to say with an undefined argument. Thus p's [[PromiseValue]] will be equal to undefined.

See more at Promises Basics.
Promises ease the task of writing complex asynchronous code. True or false?
This is discussed in detail in the Promises Introduction chapter.
What is the sequence of logs in the code shown below?
var p = new Promise(function(resolve, reject) {
    resolve("First");
});

p.then(function(data) {
    console.log(data);
});

console.log("Second");
The anonymous function passed to then() (in line 5) is executed asynchronously, which means that "Second" logs before First. This goes with choice (B). To understand why this happens please refer to Promises Basics.
If the method then() is invoked at a time its promise is settled, then it executes the corresponding callback argument synchronously. True or false?
Clearly no! If then() is called at a time its promise is settled, it executes the passed-in callback asynchronously.