Update promise_chaining.js

This commit is contained in:
xfarrow 2023-10-05 17:12:10 +02:00
parent bf06300b45
commit 3636eb2ab9

View File

@ -3,26 +3,26 @@
// .then() returns a new Promise when you do "return",
// internally calling resolve().
// new Promise(function(resolve, reject) {
new Promise(function(resolve, reject) {
// setTimeout(() => resolve(1), 1);
setTimeout(() => resolve(1), 1);
// }).then(function(result) {
}).then(function(result) {
// console.log(result);
// return result * 2;
console.log(result);
return result * 2;
// }).then(function(result) {
}).then(function(result) {
// console.log(result);
// return result * 2;
console.log(result);
return result * 2;
// }).then(function(result) {
}).then(function(result) {
// console.log(result);
// return result * 2;
console.log(result);
return result * 2;
// });
});
/*
It will print