Week 14
Quiz 30

Quiz 30: Refresher: Promises

⚠️
Warning: Executing code will replace the current content on this page with the output produced by the executed code. To return to the quiz simply reload the page using CTRL + R.

Question 1

Shows '1 1'?
JavaScript
const idPromise = x => new Promise(resolve => resolve(x));
 
idPromise(1)
    .then(it => {
        document.writeln(it);
        return it;
    })
    .then(it => document.writeln(it));

Question 2

Shows '1 1'?
JavaScript
const idPromise = x => new Promise(resolve => resolve(x));
 
idPromise(1)
    .then(it => document.writeln(it))
    .then(it => document.writeln(it));

Question 3

Shows '1'?
JavaScript
const idPromise = x => new Promise(resolve => resolve(x));
 
idPromise(1)
    .then(it => document.writeln(it));

Question 4

Shows '1'?
JavaScript
const idPromise = x => new Promise(resolve => resolve(x));
 
document.writeln(idPromise(1));