Solution Review: Promises
In this lesson, we will discuss the solutions to the questions in the previous lesson.
Press + to interact
function func1(){return new Promise(function(resolve,reject){setTimeout(function(){resolve("Func1")},1000)})}function func2(){return new Promise(function(resolve,reject){setTimeout(function(){resolve("Func2")},2000)})}func1().then(func2()).then(function(result) {console.log(result);});
For the code above, you had to answer the following question:
Explanation #
Run the code below to see the solution.
Press + to interact
function func1(){return new Promise(function(resolve,reject){setTimeout(function(){resolve("Func1")},1000)})}function func2(){return new Promise(function(resolve,reject){setTimeout(function(){resolve("Func2")},2000)})}func1().then(func2()).then(function(result) {console.log(result);});
As you can see, the correct option is ...
Access this course and 1400+ top-rated courses and projects.